You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(18) |
Aug
(33) |
Sep
(30) |
Oct
(27) |
Nov
(59) |
Dec
(30) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(67) |
Feb
(44) |
Mar
(70) |
Apr
(73) |
May
(119) |
Jun
(31) |
Jul
(92) |
Aug
(86) |
Sep
(76) |
Oct
(152) |
Nov
(156) |
Dec
(85) |
2008 |
Jan
(111) |
Feb
(121) |
Mar
(107) |
Apr
(102) |
May
(45) |
Jun
(65) |
Jul
(62) |
Aug
(133) |
Sep
(56) |
Oct
(56) |
Nov
(17) |
Dec
(15) |
2009 |
Jan
(10) |
Feb
(5) |
Mar
(10) |
Apr
(14) |
May
(49) |
Jun
(94) |
Jul
(67) |
Aug
(23) |
Sep
(9) |
Oct
(92) |
Nov
(26) |
Dec
(51) |
2010 |
Jan
(105) |
Feb
(83) |
Mar
(52) |
Apr
(59) |
May
(68) |
Jun
(71) |
Jul
(127) |
Aug
(49) |
Sep
(91) |
Oct
(27) |
Nov
(33) |
Dec
(26) |
2011 |
Jan
(26) |
Feb
(45) |
Mar
(26) |
Apr
(28) |
May
(17) |
Jun
(15) |
Jul
(45) |
Aug
(33) |
Sep
(50) |
Oct
(22) |
Nov
(10) |
Dec
(21) |
2012 |
Jan
(33) |
Feb
(24) |
Mar
(36) |
Apr
(60) |
May
(60) |
Jun
(43) |
Jul
(114) |
Aug
(19) |
Sep
(35) |
Oct
(24) |
Nov
(64) |
Dec
(12) |
2013 |
Jan
(54) |
Feb
(58) |
Mar
(51) |
Apr
(46) |
May
(21) |
Jun
(29) |
Jul
(25) |
Aug
(25) |
Sep
(13) |
Oct
(7) |
Nov
(14) |
Dec
(27) |
2014 |
Jan
(10) |
Feb
(7) |
Mar
(16) |
Apr
(14) |
May
(19) |
Jun
(8) |
Jul
(15) |
Aug
(11) |
Sep
(5) |
Oct
(11) |
Nov
(11) |
Dec
(4) |
2015 |
Jan
(52) |
Feb
(27) |
Mar
(22) |
Apr
(17) |
May
(2) |
Jun
(2) |
Jul
(2) |
Aug
(2) |
Sep
(2) |
Oct
|
Nov
(2) |
Dec
|
2016 |
Jan
(2) |
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(3) |
Aug
(2) |
Sep
(2) |
Oct
(2) |
Nov
(2) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(4) |
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(2) |
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
(2) |
Jun
(2) |
Jul
(2) |
Aug
(2) |
Sep
(1) |
Oct
(2) |
Nov
(1) |
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(3) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: <mg...@us...> - 2006-08-29 18:11:31
|
Revision: 103 Author: mgibson Date: 2006-08-29 11:11:25 -0700 (Tue, 29 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=103&view=rev Log Message: ----------- fixed bug where new table row from copy or new wasnt being scrolled to the new row isnt seen til the repaint thread happens which isnt synchronous - so hafta listen for the scrollbar changing in the context of a new or copy for the scroll setting to work - kinda silly Modified Paths: -------------- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java phenote/trunk/src/java/phenote/gui/Phenote.java Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-08-28 20:25:57 UTC (rev 102) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-08-29 18:11:25 UTC (rev 103) @@ -8,9 +8,12 @@ import javax.swing.Box; import javax.swing.JButton; import javax.swing.JPanel; +import javax.swing.JScrollBar; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.ListSelectionModel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; @@ -37,6 +40,8 @@ private JButton copyButton; private JButton deleteButton; private JButton commitButton; + private JScrollBar verticalScrollBar; + private boolean scrollToNewLastRowOnRepaint = false; private int selectedRow; // get from file menu? @@ -61,6 +66,9 @@ characterTable.setRowSelectionInterval(0,0); // select 1st row JScrollPane tableScroll = new JScrollPane(characterTable); + verticalScrollBar = tableScroll.getVerticalScrollBar();//needed for scroll to new + // wierd - changes to scrollbar seem to happen on own thread? + verticalScrollBar.getModel().addChangeListener(new ScrollChangeListener()); // width config? 150 * # of cols? set column width? column width config? characterTable.setPreferredScrollableViewportSize(new Dimension(500, 150)); @@ -133,7 +141,11 @@ be made - at least for sandbox mode. */ boolean hasRows() { return characterTableModel.hasRows(); } + private void scrollToLastRow() { + verticalScrollBar.setValue(verticalScrollBar.getMaximum()+20); + } + /** Listens to New, Copy & Delete buttons */ private class ButtonActionListener implements ActionListener { @@ -142,12 +154,14 @@ int selectRow = 0; if (e.getActionCommand().equals("New")) { selectRow = characterTableModel.addNewBlankRow(); + scrollToNewLastRowOnRepaint = true;//scrollToLastRow(); // scroll to new row } else if (!hasRows()) { return; // no rows to copy or delete } else if (e.getActionCommand().equals("Copy")) { selectRow = characterTableModel.copyRow(getSelectedRow()); + scrollToNewLastRowOnRepaint = true;//scrollToLastRow(); // scroll to new row } else if (e.getActionCommand().equals("Delete")) { selectRow = getSelectedRow(); @@ -165,17 +179,18 @@ c.getSingleDataAdapter().commit(characterTableModel.getCharacterList()); } - // if deleted last row, then need to make a new blank one (sandbox mode) + // IF DELETED LAST ROW, then need to make a new blank one (sandbox mode) if (!hasRows() && SANDBOX_MODE) { //termPanel.clear(); // SelectionManager.clearCharacterSelection() selectRow = characterTableModel.addNewBlankRow(); // sr should be 0 } selectRow(selectRow); + repaint(); // check whether enable/disable del & copy buttons - disable w no rows // doesnt happen in sandbox actually - or shouldnt buttonEnableCheck(); } - } // end of inner class + } // end of ButtonActionListener inner class /** List/row selection listener - fired when user selects new row of table @@ -222,11 +237,25 @@ } } + /** When the scrollbar changes value or range this gets called, but the task of this + class is to set the scroll bar at the end/max when a new or copy has been done so + the user sees the new thing they are working on - the scroll bar doesnt see the new + row until the repaint thread comes through, thus have to listen for scroll change + but only in the context of new & copy (which set a flag) */ + private class ScrollChangeListener implements ChangeListener { + public void stateChanged(ChangeEvent e) { + if (scrollToNewLastRowOnRepaint) + scrollToLastRow(); + scrollToNewLastRowOnRepaint = false; + } + } + // for test void pressCommitButtonTest() { commitButton.doClick(); } } + // this comes from term panel - replace with MVC stuff.... // i think this is pase? // void setSelectedGenotype(String genotype) { Modified: phenote/trunk/src/java/phenote/gui/Phenote.java =================================================================== --- phenote/trunk/src/java/phenote/gui/Phenote.java 2006-08-28 20:25:57 UTC (rev 102) +++ phenote/trunk/src/java/phenote/gui/Phenote.java 2006-08-29 18:11:25 UTC (rev 103) @@ -17,7 +17,7 @@ public class Phenote { - private static final String VERSION = "0.7.3 dev"; + private static final String VERSION = "0.7.4 dev"; //private static final String DEFAULT_CONFIG_FILE = Config.DEFAULT_CONFIG_FILE; private CharacterTablePanel characterTablePanel; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-28 20:26:10
|
Revision: 102 Author: mgibson Date: 2006-08-28 13:25:57 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=102&view=rev Log Message: ----------- refactor - made CharFieldEnum its own class - bout time improved layout of ontology chooser - snuggles in with label Modified Paths: -------------- phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/config/FieldConfig.java phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java phenote/trunk/src/java/phenote/datamodel/CharField.java phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java phenote/trunk/src/java/phenote/datamodel/OntologyManager.java phenote/trunk/src/java/phenote/edit/UpdateTransaction.java phenote/trunk/src/java/phenote/gui/AutoComboBox.java phenote/trunk/src/java/phenote/gui/CharFieldGui.java phenote/trunk/src/java/phenote/gui/CharacterTableModel.java phenote/trunk/src/java/phenote/gui/TermInfo.java phenote/trunk/src/java/phenote/gui/TermPanel.java phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java Added Paths: ----------- phenote/trunk/src/java/phenote/datamodel/CharFieldEnum.java Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2006-08-28 19:20:10 UTC (rev 101) +++ phenote/trunk/src/java/phenote/config/Config.java 2006-08-28 20:25:57 UTC (rev 102) @@ -25,7 +25,7 @@ import phenote.config.xml.FieldDocument.Field; import phenote.config.xml.OntologyDocument.Ontology; -import phenote.datamodel.CharField.CharFieldEnum; +import phenote.datamodel.CharFieldEnum; import phenote.dataadapter.DataAdapterI; import phenote.dataadapter.fly.FlybaseDataAdapter; import phenote.dataadapter.phenosyntax.PhenoSyntaxFileAdapter; Modified: phenote/trunk/src/java/phenote/config/FieldConfig.java =================================================================== --- phenote/trunk/src/java/phenote/config/FieldConfig.java 2006-08-28 19:20:10 UTC (rev 101) +++ phenote/trunk/src/java/phenote/config/FieldConfig.java 2006-08-28 20:25:57 UTC (rev 102) @@ -3,7 +3,7 @@ import java.util.ArrayList; import java.util.List; -import phenote.datamodel.CharField.CharFieldEnum; +import phenote.datamodel.CharFieldEnum; public class FieldConfig { Modified: phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java 2006-08-28 19:20:10 UTC (rev 101) +++ phenote/trunk/src/java/phenote/dataadapter/OntologyDataAdapter.java 2006-08-28 20:25:57 UTC (rev 102) @@ -16,7 +16,7 @@ import org.geneontology.oboedit.dataadapter.OBOFileAdapter; import phenote.datamodel.CharField; -import phenote.datamodel.CharField.CharFieldEnum; +import phenote.datamodel.CharFieldEnum; import phenote.datamodel.Ontology; import phenote.datamodel.OntologyManager; import phenote.config.Config; Modified: phenote/trunk/src/java/phenote/datamodel/CharField.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharField.java 2006-08-28 19:20:10 UTC (rev 101) +++ phenote/trunk/src/java/phenote/datamodel/CharField.java 2006-08-28 20:25:57 UTC (rev 102) @@ -13,70 +13,70 @@ // is this taking enums too far? or a good use of them? // would it be nice to have a class that wrapped String and OBOClass? // and all possible field values? or would that be annoying? - public enum CharFieldEnum { - PUB("Pub") { - public void setValue(CharacterI c, CharFieldValue v) { - c.setPub(v.getName()); - } - public CharFieldValue getValue(CharacterI c) { - return new CharFieldValue(c.getPub(),c,this); - } - }, - LUMP("Genotype") { // genotype? default? - public void setValue(CharacterI c, CharFieldValue v) { - c.setGenotype(v.getName()); - } - public CharFieldValue getValue(CharacterI c) { - return new CharFieldValue(c.getGenotype(),c,this); - } - }, - GENETIC_CONTEXT("Genetic Context") { - public void setValue(CharacterI c, CharFieldValue v) { - c.setGeneticContext(v.getOboClass()); - } - public CharFieldValue getValue(CharacterI c) { - return new CharFieldValue(c.getGeneticContext(),c,this); - } - }, - ENTITY("Entity") { - public void setValue(CharacterI c, CharFieldValue v) { - c.setEntity(v.getOboClass()); - } - public CharFieldValue getValue(CharacterI c) { - return new CharFieldValue(c.getEntity(),c,this); - } - }, - QUALITY("Quality") { - public void setValue(CharacterI c, CharFieldValue v) { - c.setQuality(v.getOboClass()); - } - public CharFieldValue getValue(CharacterI c) { - return new CharFieldValue(c.getQuality(),c,this); - } - }; +// public enum CharFieldEnum { - private final String name; - private CharFieldEnum(String name) { this.name = name; } - public String toString() { return name; } - public abstract void setValue(CharacterI c, CharFieldValue v); - public abstract CharFieldValue getValue(CharacterI c); +// PUB("Pub") { +// public void setValue(CharacterI c, CharFieldValue v) { +// c.setPub(v.getName()); +// } +// public CharFieldValue getValue(CharacterI c) { +// return new CharFieldValue(c.getPub(),c,this); +// } +// }, +// LUMP("Genotype") { // genotype? default? +// public void setValue(CharacterI c, CharFieldValue v) { +// c.setGenotype(v.getName()); +// } +// public CharFieldValue getValue(CharacterI c) { +// return new CharFieldValue(c.getGenotype(),c,this); +// } +// }, +// GENETIC_CONTEXT("Genetic Context") { +// public void setValue(CharacterI c, CharFieldValue v) { +// c.setGeneticContext(v.getOboClass()); +// } +// public CharFieldValue getValue(CharacterI c) { +// return new CharFieldValue(c.getGeneticContext(),c,this); +// } +// }, +// ENTITY("Entity") { +// public void setValue(CharacterI c, CharFieldValue v) { +// c.setEntity(v.getOboClass()); +// } +// public CharFieldValue getValue(CharacterI c) { +// return new CharFieldValue(c.getEntity(),c,this); +// } +// }, +// QUALITY("Quality") { +// public void setValue(CharacterI c, CharFieldValue v) { +// c.setQuality(v.getOboClass()); +// } +// public CharFieldValue getValue(CharacterI c) { +// return new CharFieldValue(c.getQuality(),c,this); +// } +// }; - // is this getting silly? abstract? --> char field value i think - //public void setOboClass(CharacterI c, OBOClass o) {} - //public OBOClass getOBOClass(CharacterI c) { return null; } - // unclear if we need this??? need it in generic field config - public static CharFieldEnum getCharFieldEnum(String fieldString) { - for ( CharFieldEnum cfe : CharFieldEnum.values()) { - if (cfe.name.equalsIgnoreCase(fieldString)) - return cfe; - } - System.out.println("ERROR: No Char Field found for string "+fieldString); - return null; - } - }; +// // CHAR FIELD ENUM vars & methods (make its own class!) +// private final String name; +// private CharFieldEnum(String name) { this.name = name; } +// public String toString() { return name; } +// public abstract void setValue(CharacterI c, CharFieldValue v); +// public abstract CharFieldValue getValue(CharacterI c); - +// // unclear if we need this??? need it in generic field config +// public static CharFieldEnum getCharFieldEnum(String fieldString) { +// for ( CharFieldEnum cfe : CharFieldEnum.values()) { +// if (cfe.name.equalsIgnoreCase(fieldString)) +// return cfe; +// } +// System.out.println("ERROR: No Char Field found for string "+fieldString); +// return null; +// } + +// }; + + // CHAR FIELD VARS private List<Ontology> ontologyList = new ArrayList<Ontology>(3); private CharFieldEnum charFieldEnum; // or subclass private String name; @@ -116,6 +116,9 @@ public boolean hasOneOntology() { return hasOntologies() && getOntologySize() == 1; } + public boolean hasMoreThanOneOntology() { + return hasOntologies() && !hasOneOntology(); + } public Ontology getOntology() { if (!hasOntologies()) return null; @@ -142,6 +145,9 @@ } } + // is this getting silly? abstract? --> char field value i think + //public void setOboClass(CharacterI c, OBOClass o) {} + //public OBOClass getOBOClass(CharacterI c) { return null; } // public CharField(CharFieldEnum c, Ontology o) { // charFieldEnum = c; // ontologyList.add(o); Added: phenote/trunk/src/java/phenote/datamodel/CharFieldEnum.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharFieldEnum.java (rev 0) +++ phenote/trunk/src/java/phenote/datamodel/CharFieldEnum.java 2006-08-28 20:25:57 UTC (rev 102) @@ -0,0 +1,68 @@ +package phenote.datamodel; + + // separate class? labels? methods? subclasses? + // is this taking enums too far? or a good use of them? + // would it be nice to have a class that wrapped String and OBOClass? + // and all possible field values? or would that be annoying? + public enum CharFieldEnum { + + PUB("Pub") { + public void setValue(CharacterI c, CharFieldValue v) { + c.setPub(v.getName()); + } + public CharFieldValue getValue(CharacterI c) { + return new CharFieldValue(c.getPub(),c,this); + } + }, + LUMP("Genotype") { // genotype? default? + public void setValue(CharacterI c, CharFieldValue v) { + c.setGenotype(v.getName()); + } + public CharFieldValue getValue(CharacterI c) { + return new CharFieldValue(c.getGenotype(),c,this); + } + }, + GENETIC_CONTEXT("Genetic Context") { + public void setValue(CharacterI c, CharFieldValue v) { + c.setGeneticContext(v.getOboClass()); + } + public CharFieldValue getValue(CharacterI c) { + return new CharFieldValue(c.getGeneticContext(),c,this); + } + }, + ENTITY("Entity") { + public void setValue(CharacterI c, CharFieldValue v) { + c.setEntity(v.getOboClass()); + } + public CharFieldValue getValue(CharacterI c) { + return new CharFieldValue(c.getEntity(),c,this); + } + }, + QUALITY("Quality") { + public void setValue(CharacterI c, CharFieldValue v) { + c.setQuality(v.getOboClass()); + } + public CharFieldValue getValue(CharacterI c) { + return new CharFieldValue(c.getQuality(),c,this); + } + }; + + + // CHAR FIELD ENUM vars & methods (make its own class!) + private final String name; + private CharFieldEnum(String name) { this.name = name; } + public String toString() { return name; } + public abstract void setValue(CharacterI c, CharFieldValue v); + public abstract CharFieldValue getValue(CharacterI c); + + // unclear if we need this??? need it in generic field config + public static CharFieldEnum getCharFieldEnum(String fieldString) { + for ( CharFieldEnum cfe : CharFieldEnum.values()) { + if (cfe.name.equalsIgnoreCase(fieldString)) + return cfe; + } + System.out.println("ERROR: No Char Field found for string "+fieldString); + return null; + } + + }; Modified: phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java 2006-08-28 19:20:10 UTC (rev 101) +++ phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java 2006-08-28 20:25:57 UTC (rev 102) @@ -2,7 +2,7 @@ import org.geneontology.oboedit.datamodel.OBOClass; -import phenote.datamodel.CharField.CharFieldEnum; +//import phenote.datamodel.CharField.CharFieldEnum; /** At the moment char field values can be Strings (genotype) and OBOClasses, and possibly more coming (Genotype?). This class attempts to hide the details of the actual Modified: phenote/trunk/src/java/phenote/datamodel/OntologyManager.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/OntologyManager.java 2006-08-28 19:20:10 UTC (rev 101) +++ phenote/trunk/src/java/phenote/datamodel/OntologyManager.java 2006-08-28 20:25:57 UTC (rev 102) @@ -6,7 +6,7 @@ import org.geneontology.oboedit.datamodel.OBOClass; -import phenote.datamodel.CharField.CharFieldEnum; +import phenote.datamodel.CharFieldEnum; /** Manages all of the ontology. Eventually will get config info (xml? OntologyConfig?) and set itself up from that. Should there be an ontology package - whats funny Modified: phenote/trunk/src/java/phenote/edit/UpdateTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/UpdateTransaction.java 2006-08-28 19:20:10 UTC (rev 101) +++ phenote/trunk/src/java/phenote/edit/UpdateTransaction.java 2006-08-28 20:25:57 UTC (rev 102) @@ -2,7 +2,7 @@ import org.geneontology.oboedit.datamodel.OBOClass; -import phenote.datamodel.CharField.CharFieldEnum; +import phenote.datamodel.CharFieldEnum; import phenote.datamodel.CharFieldValue; import phenote.datamodel.CharacterI; Modified: phenote/trunk/src/java/phenote/gui/AutoComboBox.java =================================================================== --- phenote/trunk/src/java/phenote/gui/AutoComboBox.java 2006-08-28 19:20:10 UTC (rev 101) +++ phenote/trunk/src/java/phenote/gui/AutoComboBox.java 2006-08-28 20:25:57 UTC (rev 102) @@ -23,7 +23,7 @@ import org.geneontology.oboedit.datamodel.OBOClass; import phenote.datamodel.CharField; -import phenote.datamodel.CharField.CharFieldEnum; +import phenote.datamodel.CharFieldEnum; import phenote.datamodel.CharacterI; import phenote.datamodel.Ontology; import phenote.datamodel.SearchParamsI; Modified: phenote/trunk/src/java/phenote/gui/CharFieldGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharFieldGui.java 2006-08-28 19:20:10 UTC (rev 101) +++ phenote/trunk/src/java/phenote/gui/CharFieldGui.java 2006-08-28 20:25:57 UTC (rev 102) @@ -10,7 +10,7 @@ import javax.swing.event.DocumentEvent; import phenote.datamodel.CharField; -import phenote.datamodel.CharField.CharFieldEnum; +import phenote.datamodel.CharFieldEnum; import phenote.datamodel.CharacterI; import phenote.datamodel.Ontology; import phenote.datamodel.OntologyManager; @@ -93,9 +93,9 @@ isCombo = true; String name = charField.getFirstOntology().getName(); - JLabel label = termPanel.addLabel(name,parent); + JLabel label = termPanel.addLabel(name,parent,charField.hasMoreThanOneOntology()); // if has more than one ontology(entity) than add ontology choose list - if (!charField.hasOneOntology()) { + if (charField.hasMoreThanOneOntology()) { label.setText(charField.getName()); initOntologyChooser(charField,parent); } Modified: phenote/trunk/src/java/phenote/gui/CharacterTableModel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-08-28 19:20:10 UTC (rev 101) +++ phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-08-28 20:25:57 UTC (rev 102) @@ -8,7 +8,7 @@ import phenote.datamodel.Character; import phenote.datamodel.CharacterI; import phenote.datamodel.CharacterListI; -import phenote.datamodel.CharField.CharFieldEnum; +import phenote.datamodel.CharFieldEnum; import phenote.dataadapter.CharacterListManager; import phenote.config.Config; Modified: phenote/trunk/src/java/phenote/gui/TermInfo.java =================================================================== --- phenote/trunk/src/java/phenote/gui/TermInfo.java 2006-08-28 19:20:10 UTC (rev 101) +++ phenote/trunk/src/java/phenote/gui/TermInfo.java 2006-08-28 20:25:57 UTC (rev 102) @@ -29,7 +29,7 @@ import org.geneontology.oboedit.datamodel.OBOClass; import phenote.datamodel.CharacterI; -import phenote.datamodel.CharField.CharFieldEnum; +import phenote.datamodel.CharFieldEnum; import phenote.datamodel.OntologyManager; import phenote.edit.EditManager; import phenote.edit.UpdateTransaction; @@ -55,8 +55,8 @@ JComponent getComponent() { JPanel termInfoPanel = new JPanel(new BorderLayout(0,0)); // hgap,vgap - termInfoPanel.setPreferredSize(new Dimension(500,700)); - termInfoPanel.setMinimumSize(new Dimension(300,500)); + termInfoPanel.setPreferredSize(new Dimension(600,700)); + termInfoPanel.setMinimumSize(new Dimension(350,500)); if (DO_HTML) { JEditorPane editorPane = new JEditorPane(); editorPane.setContentType("text/html"); // sets up HTMLEditorKit @@ -75,7 +75,8 @@ scrollPane.setPreferredSize(new Dimension(400,300)); scrollPane.setMaximumSize(new Dimension(400,300)); // border - make JPanel for it (there is a disclaimer about non JPanel) - scrollPane.setBorder(BorderFactory.createTitledBorder("Term Info")); + //scrollPane.setBorder(BorderFactory.createTitledBorder("Term Info")); + termInfoPanel.setBorder(BorderFactory.createTitledBorder("Term Info")); termInfoPanel.add(scrollPane,BorderLayout.CENTER); JButton useTermButton = new JButton("Use Term"); Modified: phenote/trunk/src/java/phenote/gui/TermPanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/TermPanel.java 2006-08-28 19:20:10 UTC (rev 101) +++ phenote/trunk/src/java/phenote/gui/TermPanel.java 2006-08-28 20:25:57 UTC (rev 102) @@ -17,7 +17,7 @@ import javax.swing.JPanel; import phenote.datamodel.CharField; -import phenote.datamodel.CharField.CharFieldEnum; +import phenote.datamodel.CharFieldEnum; import phenote.datamodel.CharacterI; import phenote.datamodel.Ontology; import phenote.datamodel.OntologyManager; @@ -75,8 +75,12 @@ } JLabel addLabel(String labelString,Container parent) { + return addLabel(labelString,parent,false); // false - no ont chooser + } + + JLabel addLabel(String labelString,Container parent,boolean hasOntChooser) { JLabel label = new JLabel(labelString); - GridBagConstraints gbc = makeLabelConstraint(); + GridBagConstraints gbc = makeLabelConstraint(hasOntChooser); parent.add(label,gbc); return label; } @@ -92,23 +96,25 @@ private int gridbagRow = 0; boolean ontologyChooserPresent = false; - private GridBagConstraints makeLabelConstraint() { - ontologyChooserPresent = false; // cheesy + private GridBagConstraints makeLabelConstraint(boolean hasOntChooser) { + ontologyChooserPresent = hasOntChooser; // ?? // x,y,horizPad,vertPad // make width 2 unless theres a chooser, then 1 - return GridBagUtil.makeConstraint(0,gridbagRow,1,3); + int width = hasOntChooser ? 1 : 2; + return GridBagUtil.makeWidthConstraint(0,gridbagRow,1,3,width); } + private GridBagConstraints makeOntologyChooserConstraint() { + ontologyChooserPresent = true; // cheesy - dont need? + return GridBagUtil.makeConstraint(1,gridbagRow,1,3); // width 1 + } + private GridBagConstraints makeFieldConstraint() { - int x = ontologyChooserPresent ? 2 : 1; - int width = ontologyChooserPresent ? 1 : 2; // ??? + int x = 2;//ontologyChooserPresent ? 2 : 1; + int width = 1;//ontologyChooserPresent ? 1 : 2; // ??? return GridBagUtil.makeWidthConstraint(x,gridbagRow++,1,3,width); } - private GridBagConstraints makeOntologyChooserConstraint() { - ontologyChooserPresent = true; // cheesy - return GridBagUtil.makeConstraint(1,gridbagRow,1,3); - } // for test and term info to listen - move to test code? Modified: phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-28 19:20:10 UTC (rev 101) +++ phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-28 20:25:57 UTC (rev 102) @@ -12,7 +12,7 @@ import org.geneontology.oboedit.datamodel.OBOClass; import phenote.datamodel.CharField; -import phenote.datamodel.CharField.CharFieldEnum; +import phenote.datamodel.CharFieldEnum; import phenote.datamodel.Ontology; import phenote.datamodel.OntologyManager; import phenote.datamodel.SearchParamsI; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-28 19:20:29
|
Revision: 101 Author: mgibson Date: 2006-08-28 12:20:10 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=101&view=rev Log Message: ----------- fixed a few things bug in free text fields on entering text got exception -woops - from char change event coming back to itself (added for term info) can now read pheno syntax files pheno syntax now does ids not names (which i think is less readable) resize/layout much better - things were shriveling up on resize - i added min & pref sizes to fix still want to get layout of ontology chooser better Modified Paths: -------------- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java phenote/trunk/src/java/phenote/datamodel/OntologyManager.java phenote/trunk/src/java/phenote/gui/CharFieldGui.java phenote/trunk/src/java/phenote/gui/CharacterTableModel.java phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java phenote/trunk/src/java/phenote/gui/Phenote.java phenote/trunk/src/java/phenote/gui/SearchParamPanel.java phenote/trunk/src/java/phenote/gui/TermInfo.java phenote/trunk/src/java/phenote/gui/TermPanel.java phenote/trunk/src/java/phenote/util/HtmlUtil.java Modified: phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2006-08-25 18:27:12 UTC (rev 100) +++ phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2006-08-28 19:20:10 UTC (rev 101) @@ -1,8 +1,13 @@ package phenote.dataadapter.phenosyntax; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + import org.geneontology.oboedit.datamodel.OBOClass; +import phenote.datamodel.Character; import phenote.datamodel.CharacterI; +import phenote.datamodel.OntologyManager; /** A phenotype character thats basically a dataadapter object for datamodel CharacterI. It can make a phenosyntax string from a CharacterI and make @@ -19,18 +24,20 @@ private CharacterI character; private String phenoSyntaxString; + PhenoSyntaxChar() {} + PhenoSyntaxChar(CharacterI ch) { character = ch; } - String getPhenoSyntaxString() { + String getPhenoSyntaxString() throws BadCharException { if (phenoSyntaxString == null) { phenoSyntaxString = makeSyntaxString(); } return phenoSyntaxString; } - private String makeSyntaxString() { + private String makeSyntaxString() throws BadCharException { if (character == null) { // shouldnt happen System.out.println("Error: no Character to make phenoSyntax string with"); return ""; //?? @@ -43,29 +50,37 @@ // i would say its an omission from syntax sb.append(" GT=").append(character.getGenotype()); if (character.hasGeneticContext()) - sb.append(" GC=").append(idPrefixAndName(character.getGeneticContext())); - if (character.getEntity() == null) { - System.out.println("Error: character has no entity, ignoring"); - return ""; - } - sb.append(" E=").append(idPrefixAndName(character.getEntity())); - if (character.getQuality() == null) { - System.out.println("Error: character has no quality, ignoring"); - return ""; - } - sb.append(" Q=").append(idPrefixAndName(character.getQuality())); + sb.append(" GC=").append(makeValue(character.getGeneticContext())); + if (character.getEntity() == null) + throw new BadCharException("Error: character has no entity, ignoring"); + sb.append(" E=").append(makeValue(character.getEntity())); + + if (character.getQuality() == null) + throw new BadCharException("Error: character has no quality, ignoring"); + sb.append(" Q=").append(makeValue(character.getQuality())); + return sb.toString(); } + // this may be more general than just this class + class BadCharException extends Exception { + BadCharException(String m) { super(m); } + } + + private String makeValue(OBOClass term) { + // return idPrefixAndName(term); // michael wants ids... + return term.getID(); + } + /** Merges id prefix and name, so for id GO:1234 with name "growth" returns - "GO:growth", which is readable and computable & syn acceptable */ + "GO:growth", which is readable and computable & syn acceptable - pase - doing ids*/ private String idPrefixAndName(OBOClass term) { return getIdPrefix(term)+term.getName(); } - /** for GO:12345 returns GO: - with colon! */ + /** for GO:12345 returns GO: - with colon! - pase - doing ids */ private String getIdPrefix(OBOClass term) { if (term == null) return ""; // shouldnt happen String id = term.getID(); @@ -73,4 +88,74 @@ return id.substring(0,colonIndex+1); // +1 retain colon } + // READ + + /** Parse syntax line into character */ + void parseLine(String line) throws SyntaxParseException { + character = new Character(); + Pattern p = Pattern.compile("\\S+=");//\\S+="); + Matcher m = p.matcher(line); + boolean found = m.find(); + if (!found) + throw new SyntaxParseException(line); // skips whitespace lines + int tagStart = m.start(); + int tagEnd = m.end(); + while (found) { + String tag = line.substring(tagStart,tagEnd-1); // -1 take off = + int valueStart = tagEnd; + // find next one will give end of value + found = m.find(); // if parsing last tag found will be false - at end + tagStart = found ? m.start() : line.length(); + if (found) tagEnd = m.end(); // dont need if not found (last one) + String value = line.substring(valueStart,tagStart).trim(); + //System.out.println("tag ."+tag+". val ."+value+"."); + addTagValToChar(tag,value); + } + } + + class SyntaxParseException extends Exception { + private String syntaxLine; + SyntaxParseException(String syntaxLine) { + this.syntaxLine = syntaxLine; + } + public String getMessage() { + if (syntaxLine.trim().equals("")) + return ""; // just whitespace - who cares + return syntaxLine+" failed to parse - ignoring"; + } + } + + private void addTagValToChar(String tag, String value) { + if (value.equals("")) { + System.out.println("No value given for "+tag); + return; + } + + OntologyManager om = OntologyManager.inst(); + + try { + if (tag.equals("PUB")) + character.setPub(value); + else if (tag.equals("GT")) + character.setGenotype(value); + else if (tag.equals("GC")) + character.setGeneticContext(om.getOboClassWithExcep(value)); // throws ex + else if (tag.equals("E")) + character.setEntity(om.getOboClassWithExcep(value)); + else if (tag.equals("Q")) + character.setQuality(om.getOboClassWithExcep(value)); + else // throw exception? or let rest of char go through? + System.out.println("pheno syntax tag "+tag+" not recognized (value "+value+")"); + } + catch (OntologyManager.TermNotFoundException e) { + System.out.println("Term not found for tag "+tag+" value "+value+" in loaded " + +"ontologies - check syntax with ontology files."); + return; + } + + } + + + + CharacterI getCharacter() { return character; } } Modified: phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java 2006-08-25 18:27:12 UTC (rev 100) +++ phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java 2006-08-28 19:20:10 UTC (rev 101) @@ -3,11 +3,15 @@ import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; +import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; +import java.io.LineNumberReader; import phenote.datamodel.CharacterI; import phenote.datamodel.CharacterListI; +import phenote.datamodel.CharacterList; +import phenote.dataadapter.CharacterListManager; import phenote.dataadapter.DataAdapterI; import phenote.dataadapter.phenoxml.PhenoXmlAdapter; @@ -18,14 +22,44 @@ public class PhenoSyntaxFileAdapter implements DataAdapterI { - public void load() {} + /** this should return CharacterList and caller should load CharListMan + or CLM makes the call itself? */ + public void load() { + File file = getFileFromUser(); + if (file == null) return; + + try { + CharacterListI charList = new CharacterList(); + LineNumberReader lnr = new LineNumberReader(new FileReader(file)); + PhenoSyntaxChar synChar = new PhenoSyntaxChar(); + for (String line=lnr.readLine(); line != null; line = lnr.readLine()) { + try { + synChar.parseLine(line); + CharacterI ch = synChar.getCharacter(); + charList.add(ch); + } catch (PhenoSyntaxChar.SyntaxParseException e) { + System.out.println(e.getMessage()); // jut "" for whitespace line + } + } + CharacterListManager.inst().setCharacterList(this,charList); + lnr.close(); + } + catch (IOException e) { + System.out.println("PhenoSyntax read failure "+e); + } + } + + /** returns null if user fails to pick a file */ + private File getFileFromUser() { + return PhenoXmlAdapter.getFile(); // perhaps a util class + } + public void commit(CharacterListI charList) { + + File file = getFileFromUser(); + if (file == null) return; - File file = PhenoXmlAdapter.getFile(); // perhaps a util class - if (file == null) - return; - PrintWriter pw; try { pw = new PrintWriter(new BufferedWriter(new FileWriter(file))); @@ -33,11 +67,18 @@ System.out.println("Failed to open file "+file); return; } - + + System.out.println("Writing pheno syntax to file "+file); + for (CharacterI ch : charList.getList()) { - String c = new PhenoSyntaxChar(ch).getPhenoSyntaxString(); + try { + String c = new PhenoSyntaxChar(ch).getPhenoSyntaxString(); System.out.println(c); - pw.println(c); + pw.println(c); + } + catch (PhenoSyntaxChar.BadCharException e) { + System.out.println(e.getMessage()+" Not writing out character"); + } } pw.close(); } Modified: phenote/trunk/src/java/phenote/datamodel/OntologyManager.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/OntologyManager.java 2006-08-25 18:27:12 UTC (rev 100) +++ phenote/trunk/src/java/phenote/datamodel/OntologyManager.java 2006-08-28 19:20:10 UTC (rev 101) @@ -76,6 +76,17 @@ return null; // not found - null } + public OBOClass getOboClassWithExcep(String id) throws TermNotFoundException { + OBOClass term = getOboClass(id); + if (term == null) + throw new TermNotFoundException("ID "+id+" not found in loaded ontologies"); + return term; + } + + public class TermNotFoundException extends Exception { + private TermNotFoundException(String m) { super(m); } + } + /** for obo class find its char field enum via ontology & char field */ public CharFieldEnum getCharFieldEnumForOboClass(OBOClass oboClass) { for (CharField cf : charFieldList) { Modified: phenote/trunk/src/java/phenote/gui/CharFieldGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharFieldGui.java 2006-08-25 18:27:12 UTC (rev 100) +++ phenote/trunk/src/java/phenote/gui/CharFieldGui.java 2006-08-28 19:20:10 UTC (rev 101) @@ -54,7 +54,7 @@ private class FieldCharChangeListener implements CharChangeListener { public void charChanged(CharChangeEvent e) { // check charField is this char field - if (e.isForCharField(charField)) + if (e.getSource() != CharFieldGui.this && e.isForCharField(charField)) // i think all we need to do is setText to synch with model setText(e.getValueString()); } @@ -71,6 +71,10 @@ /** Set the gui from the model */ void setValueFromChar(CharacterI character) { + if (character == null) { + System.out.println("ERROR: setting to null character"); + return; + } if (charField == null) return; if (charField.getCharFieldEnum() == null) { System.out.println("ERROR: Cant set value for field. Gui for character field has" @@ -153,7 +157,7 @@ // i believe this isnt using oboClass as we just have string String v = getText(); UpdateTransaction ut = new UpdateTransaction(c,getCharFieldEnum(),v,previousVal); - EditManager.inst().updateModel(this,ut); + EditManager.inst().updateModel(CharFieldGui.this,ut); previousVal = v; // undo } } Modified: phenote/trunk/src/java/phenote/gui/CharacterTableModel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-08-25 18:27:12 UTC (rev 100) +++ phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-08-28 19:20:10 UTC (rev 101) @@ -95,6 +95,10 @@ public Object getValueAt(int row, int col) { CharacterI inst = getCharacter(row); + if (inst == null) { + System.out.println("ERROR: character is null for row "+row+" in table"); + return null; + } if (config.getCharFieldEnum(col) == null) { System.out.println("Error column "+col+" not configured proplerly in "+ "character table, cant retrieve value "); Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-08-25 18:27:12 UTC (rev 100) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-08-28 19:20:10 UTC (rev 101) @@ -50,7 +50,9 @@ private void init() { setLayout(new GridLayout(2,1)); // row,col - + setPreferredSize(new Dimension(400,800)); + setMinimumSize(new Dimension(400,500)); + characterTableModel = new CharacterTableModel(); characterTable = new JTable(characterTableModel); characterTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); @@ -60,7 +62,7 @@ JScrollPane tableScroll = new JScrollPane(characterTable); // width config? 150 * # of cols? set column width? column width config? - characterTable.setPreferredScrollableViewportSize(new Dimension(600, 150)); + characterTable.setPreferredScrollableViewportSize(new Dimension(500, 150)); add(tableScroll); Modified: phenote/trunk/src/java/phenote/gui/Phenote.java =================================================================== --- phenote/trunk/src/java/phenote/gui/Phenote.java 2006-08-25 18:27:12 UTC (rev 100) +++ phenote/trunk/src/java/phenote/gui/Phenote.java 2006-08-28 19:20:10 UTC (rev 101) @@ -2,6 +2,7 @@ // package phenote.main? +import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.BoxLayout; @@ -16,7 +17,7 @@ public class Phenote { - private static final String VERSION = "0.7.1 dev"; + private static final String VERSION = "0.7.3 dev"; //private static final String DEFAULT_CONFIG_FILE = Config.DEFAULT_CONFIG_FILE; private CharacterTablePanel characterTablePanel; @@ -82,6 +83,7 @@ JFrame frame = new JFrame("Phenote "+VERSION); // this may be changed to applet... frame.getContentPane().add(makeMainPanel()); MenuManager.createMenuManager(frame); + frame.setPreferredSize(new Dimension(1000,550)); frame.pack(); frame.setVisible(true); } Modified: phenote/trunk/src/java/phenote/gui/SearchParamPanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/SearchParamPanel.java 2006-08-25 18:27:12 UTC (rev 100) +++ phenote/trunk/src/java/phenote/gui/SearchParamPanel.java 2006-08-28 19:20:10 UTC (rev 101) @@ -1,5 +1,6 @@ package phenote.gui; +import java.awt.Dimension; import javax.swing.BoxLayout; import javax.swing.JLabel; import javax.swing.JPanel; @@ -20,6 +21,8 @@ JPanel getPanel() { JPanel panel = new JPanel(); + panel.setMinimumSize(new Dimension(305,150)); + // panel.setPreferredSize(new Dimension(250,250)); ?? BoxLayout boxLayout = new BoxLayout(panel,BoxLayout.Y_AXIS); panel.setLayout(boxLayout); panel.add(new JLabel("Search:")); Modified: phenote/trunk/src/java/phenote/gui/TermInfo.java =================================================================== --- phenote/trunk/src/java/phenote/gui/TermInfo.java 2006-08-25 18:27:12 UTC (rev 100) +++ phenote/trunk/src/java/phenote/gui/TermInfo.java 2006-08-28 19:20:10 UTC (rev 101) @@ -55,6 +55,8 @@ JComponent getComponent() { JPanel termInfoPanel = new JPanel(new BorderLayout(0,0)); // hgap,vgap + termInfoPanel.setPreferredSize(new Dimension(500,700)); + termInfoPanel.setMinimumSize(new Dimension(300,500)); if (DO_HTML) { JEditorPane editorPane = new JEditorPane(); editorPane.setContentType("text/html"); // sets up HTMLEditorKit Modified: phenote/trunk/src/java/phenote/gui/TermPanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/TermPanel.java 2006-08-25 18:27:12 UTC (rev 100) +++ phenote/trunk/src/java/phenote/gui/TermPanel.java 2006-08-28 19:20:10 UTC (rev 101) @@ -95,6 +95,7 @@ private GridBagConstraints makeLabelConstraint() { ontologyChooserPresent = false; // cheesy // x,y,horizPad,vertPad + // make width 2 unless theres a chooser, then 1 return GridBagUtil.makeConstraint(0,gridbagRow,1,3); } Modified: phenote/trunk/src/java/phenote/util/HtmlUtil.java =================================================================== --- phenote/trunk/src/java/phenote/util/HtmlUtil.java 2006-08-25 18:27:12 UTC (rev 100) +++ phenote/trunk/src/java/phenote/util/HtmlUtil.java 2006-08-28 19:20:10 UTC (rev 101) @@ -49,7 +49,7 @@ if (definition != null && !definition.equals("")) sb.append(nl()).append(nl()).append(bold("Definition: ")).append(definition); - System.out.println(sb); + // if (DEBUG) System.out.println(sb); return sb.toString(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-25 18:27:30
|
Revision: 100 Author: mgibson Date: 2006-08-25 11:27:12 -0700 (Fri, 25 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=100&view=rev Log Message: ----------- Added "Use Term" button in term info that commits the currently browsed term to the datamodel - this was sorely needed for a while now as it was silly to browse a term and then not be able to shove it in. eventually would like to be able to do with a double click - need to somehow supress first click. TermInfo sends out update transaction with obo class - CharFieldEnum is figured via OnotologyManager - figures out which field needs to get updated - and encodes in transaction. CharFieldGui listens for char change event which maybe should be called char field change event - and queries if the field is its field and if so updates to string in event, and thus synchs with model. Modified Paths: -------------- phenote/trunk/build.xml phenote/trunk/src/java/phenote/datamodel/CharField.java phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java phenote/trunk/src/java/phenote/datamodel/Ontology.java phenote/trunk/src/java/phenote/datamodel/OntologyManager.java phenote/trunk/src/java/phenote/edit/CharChangeEvent.java phenote/trunk/src/java/phenote/edit/EditManager.java phenote/trunk/src/java/phenote/edit/UpdateTransaction.java phenote/trunk/src/java/phenote/gui/AutoComboBox.java phenote/trunk/src/java/phenote/gui/CharFieldGui.java phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java phenote/trunk/src/java/phenote/gui/TermInfo.java phenote/trunk/src/java/phenote/util/HtmlUtil.java Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2006-08-24 19:19:49 UTC (rev 99) +++ phenote/trunk/build.xml 2006-08-25 18:27:12 UTC (rev 100) @@ -146,7 +146,7 @@ <target name="test" depends="build-test"> - <java classname="org.junit.runner.JUnitCore" fork="yes"> + <java classname="org.junit.runner.JUnitCore" fork="yes" jvmargs="-Xmx120M"> <arg value="phenote.gui.TestPhenote"/> <classpath> <pathelement path="${classfiles}"/> Modified: phenote/trunk/src/java/phenote/datamodel/CharField.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharField.java 2006-08-24 19:19:49 UTC (rev 99) +++ phenote/trunk/src/java/phenote/datamodel/CharField.java 2006-08-25 18:27:12 UTC (rev 100) @@ -81,16 +81,7 @@ private CharFieldEnum charFieldEnum; // or subclass private String name; -// public CharField(CharFieldEnum c, Ontology o) { -// charFieldEnum = c; -// ontologyList.add(o); -// } -// public CharField(CharFieldEnum c, String n) { -// charFieldEnum = c; -// name = n; -// } - public CharField(CharFieldEnum c) { charFieldEnum = c; } @@ -118,12 +109,14 @@ boolean isGeneticContext() { return charFieldEnum == CharFieldEnum.GENETIC_CONTEXT; } public List<Ontology> getOntologyList() { return ontologyList; } + public boolean hasOntologies() { return ontologyList != null && !ontologyList.isEmpty(); } public boolean hasOneOntology() { return hasOntologies() && getOntologySize() == 1; } + public Ontology getOntology() { if (!hasOntologies()) return null; return getFirstOntology(); @@ -149,7 +142,16 @@ } } +// public CharField(CharFieldEnum c, Ontology o) { +// charFieldEnum = c; +// ontologyList.add(o); +// } +// public CharField(CharFieldEnum c, String n) { +// charFieldEnum = c; +// name = n; +// } + // hmmmmmm.... wrap String & OBOClass in one class // public class CharFieldValue { // OBOClass oboClassValue Modified: phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java 2006-08-24 19:19:49 UTC (rev 99) +++ phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java 2006-08-25 18:27:12 UTC (rev 100) @@ -50,6 +50,8 @@ charFieldEnum.setValue(character,this); } + public CharFieldEnum getCharFieldEnum() { return charFieldEnum; } + public String toString() { return getName(); } } Modified: phenote/trunk/src/java/phenote/datamodel/Ontology.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/Ontology.java 2006-08-24 19:19:49 UTC (rev 99) +++ phenote/trunk/src/java/phenote/datamodel/Ontology.java 2006-08-25 18:27:12 UTC (rev 100) @@ -51,6 +51,12 @@ return oboSession.getTerm(id); } + /** Returns true if ontology holds obo class */ + boolean hasOboClass(OBOClass oboClass) { + // if this is too slow can do optimizations with prefixes + return getOboClass(oboClass.getID()) != null; + } + /** Returns a Vector of OBOTerms from ontology that contain input string constrained by compParams. compParams specifies syns,terms,defs,& obs should input be just part of search params? @@ -70,8 +76,7 @@ // if obsoletes set then add them in addition to regulars if (searchParams.searchObsoletes()) { ontologyTermList = getSortedObsoleteTerms(); - Vector obsoletes = getSearchTerms(input,ontologyTermList,searchParams) -; + Vector obsoletes = getSearchTerms(input,ontologyTermList,searchParams); searchTerms.addAll(obsoletes); } return searchTerms; @@ -255,6 +260,10 @@ } } + + +// GARBAGE + // /** Load up/cache Sets for all ontologies used, anatomyOntologyTermSet // * and patoOntologyTermSet -- move to dataadapter/OntologyDataAdapter... */ // private void loadOntology(String filename) {//loadAllOntologyTerms() { Modified: phenote/trunk/src/java/phenote/datamodel/OntologyManager.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/OntologyManager.java 2006-08-24 19:19:49 UTC (rev 99) +++ phenote/trunk/src/java/phenote/datamodel/OntologyManager.java 2006-08-25 18:27:12 UTC (rev 100) @@ -15,27 +15,17 @@ actually manages CharFields(which may have ontologies) - rename CharFieldManager?*/ public class OntologyManager { - final static String ANATOMY = "Anatomy"; - final static String PATO = "Pato"; - final static String TAXONOMY = "Taxonomy"; private static OntologyManager singleton; - private Ontology lumpOntology; - private List<Ontology> entityOntologyList; - //private Ontology entityOntology; - private Ontology patoOntology; + // isnt this redundant with charFieldList? convenience? private List<Ontology> allOntologyList = new ArrayList<Ontology>(); - private Ontology geneticContextOntology; - //private Map<CharFieldEnum,List<Ontology>> fieldToOntologyList; - /** CharFields generically hold one or more ontologies - i think above - hardwired fields are pase - or at least should be */ + /** CharFields generically hold one or more ontologies - are charFields that dont + have ontologies in this list?? not sure */ private List<CharField> charFieldList = new ArrayList<CharField>(6); /** Singleton */ - private OntologyManager() { - //fieldToOntologyList = new HashMap<CharFieldEnum,List<Ontology>>(); - } + private OntologyManager() {} public static OntologyManager inst() { if (singleton == null) @@ -43,86 +33,8 @@ return singleton; } - // public List<Ontology> getOntologyList(CharFieldEnum e) {} - - public boolean haveLumpOntology() { return getLumpOntology() != null; } - - public void setLumpOntology(Ontology lo) { - lumpOntology = lo; - addOntology(lumpOntology); - } - - public Ontology getLumpOntology() { - return lumpOntology; - } - - public void setEntityOntologyList(List<Ontology> entList) { - entityOntologyList = entList; - } - - public void addEntityOntology(Ontology o) { - getEntityOntologyList().add(o); - allOntologyList.add(o); - } - - public List<Ontology> getEntityOntologyList() { - if (entityOntologyList == null) - entityOntologyList = new ArrayList<Ontology>(); - return entityOntologyList; - } - - // for now just 1 - public Ontology getEntityOntology() { - return getEntityOntologyList().get(0); - } - - /** Set from OntologyDataAdapter */ - public void setPatoOntology(Ontology patoOntology) { - this.patoOntology = patoOntology; - addOntology(patoOntology); - } - - // pase? - public Ontology getPatoOntology() { - //if (patoOntology != null) - return patoOntology; - } - - public boolean hasGeneticContext() { - return geneticContextOntology != null; - } - - public void setGeneticContextOntology(Ontology gc) { - geneticContextOntology = gc; - addOntology(geneticContextOntology); - } - - public Ontology getGeneticContextOntology() { - return geneticContextOntology; - } - - - // eventually... - // Ontology getOntology(CharFieldEnum c) { return fieldToOntology.get(c); } - -// public void addOntology(CharFieldEnum c, Ontology o) { -// // for now... -// if (c == CharFieldEnum.GENETIC_CONTEXT) -// setGeneticContextOntology(o); -// addOntology(o); - -// // OR -// // addOntologyToMap(c,o); - -// // OR -// charFieldList.add(new CharField(c,o)); -// } public void addField(CharField cf) { - // for now... - // if hasOnlyOne? for (Ontology :...)? - if (cf.isGeneticContext()) - setGeneticContextOntology(cf.getFirstOntology()); addOntologyList(cf.getOntologyList()); charFieldList.add(cf); } @@ -141,23 +53,7 @@ return null; } - // for now i know that only genetic context is in char field list... - public CharField getGeneticContextCharField() { - if (charFieldList == null || charFieldList.isEmpty()) - return null; - return charFieldList.get(0); // revisit this!!!! - } - -// private void addOntologyToMap(CharFieldEnum c, Ontology o) { -// List<Ontology> l = fieldToOntologyList.get(c); -// if (l == null) { -// l = new ArrayList<Ontology>(3); -// fieldToOntologyList.put(c,l); -// } -// l.add(o); -// } - private void addOntologyList(List<Ontology> l) { allOntologyList.addAll(l); } @@ -180,8 +76,126 @@ return null; // not found - null } - // ??? + /** for obo class find its char field enum via ontology & char field */ + public CharFieldEnum getCharFieldEnumForOboClass(OBOClass oboClass) { + for (CharField cf : charFieldList) { + //if (!cf.hasOntologies()) continue; // is this needed? not sure + for (Ontology ont : cf.getOntologyList()) { + if (ont.hasOboClass(oboClass)) + return cf.getCharFieldEnum(); + } + } + return null; // this shouldnt happen - err msg? + } +} + // i think char field now does this + //fieldToOntologyList = new HashMap<CharFieldEnum,List<Ontology>>(); + //private Map<CharFieldEnum,List<Ontology>> fieldToOntologyList; +// private List<Ontology> entityOntologyList; + //private Ontology geneticContextOntology; + //private Ontology lumpOntology; + //private Ontology entityOntology; + //private Ontology patoOntology; -} +// final static String ANATOMY = "Anatomy"; +// final static String PATO = "Pato"; +// final static String TAXONOMY = "Taxonomy"; + // for now... + // if hasOnlyOne? for (Ontology :...)? +// if (cf.isGeneticContext()) +// setGeneticContextOntology(cf.getFirstOntology()); + + // for now i know that only genetic context is in char field list... +// public CharField getGeneticContextCharField() { +// if (charFieldList == null || charFieldList.isEmpty()) +// return null; +// return charFieldList.get(0); // revisit this!!!! +// } + + +// private void addOntologyToMap(CharFieldEnum c, Ontology o) { +// List<Ontology> l = fieldToOntologyList.get(c); +// if (l == null) { +// l = new ArrayList<Ontology>(3); +// fieldToOntologyList.put(c,l); +// } +// l.add(o); +// } + + + // public List<Ontology> getOntologyList(CharFieldEnum e) {} + +// public boolean haveLumpOntology() { return getLumpOntology() != null; } + +// public void setLumpOntology(Ontology lo) { +// lumpOntology = lo; +// addOntology(lumpOntology); +// } + +// public Ontology getLumpOntology() { +// return lumpOntology; +// } + +// public void setEntityOntologyList(List<Ontology> entList) { +// entityOntologyList = entList; +// } + +// public void addEntityOntology(Ontology o) { +// getEntityOntologyList().add(o); +// allOntologyList.add(o); +// } + +// public List<Ontology> getEntityOntologyList() { +// if (entityOntologyList == null) +// entityOntologyList = new ArrayList<Ontology>(); +// return entityOntologyList; +// } + +// // for now just 1 +// public Ontology getEntityOntology() { +// return getEntityOntologyList().get(0); +// } + + /** Set from OntologyDataAdapter */ +// public void setPatoOntology(Ontology patoOntology) { +// this.patoOntology = patoOntology; +// addOntology(patoOntology); +// } + + // pase? +// public Ontology getPatoOntology() { +// //if (patoOntology != null) +// return patoOntology; +// } + +// public boolean hasGeneticContext() { +// return geneticContextOntology != null; +// } + +// public void setGeneticContextOntology(Ontology gc) { +// geneticContextOntology = gc; +// addOntology(geneticContextOntology); +// } + +// public Ontology getGeneticContextOntology() { +// return geneticContextOntology; +// } + + + // eventually... + // Ontology getOntology(CharFieldEnum c) { return fieldToOntology.get(c); } + +// public void addOntology(CharFieldEnum c, Ontology o) { +// // for now... +// if (c == CharFieldEnum.GENETIC_CONTEXT) +// setGeneticContextOntology(o); +// addOntology(o); + +// // OR +// // addOntologyToMap(c,o); + +// // OR +// charFieldList.add(new CharField(c,o)); +// } Modified: phenote/trunk/src/java/phenote/edit/CharChangeEvent.java =================================================================== --- phenote/trunk/src/java/phenote/edit/CharChangeEvent.java 2006-08-24 19:19:49 UTC (rev 99) +++ phenote/trunk/src/java/phenote/edit/CharChangeEvent.java 2006-08-25 18:27:12 UTC (rev 100) @@ -2,13 +2,26 @@ import java.util.EventObject; +import phenote.datamodel.CharField; + +/** This actually is for a CharField change - rename this CharFieldChangeEvent? */ public class CharChangeEvent extends EventObject { // UpdateTrans -> Transaction? private UpdateTransaction transaction; + // boolean undo??? or in trans? of just editManager? CharChangeEvent(Object source, UpdateTransaction ut) { super(source); transaction = ut; } + + public String getValueString() { // getNewVal, getOldVal??? + // if undo return ut.getOldValue().getName()??? + return transaction.getNewValueString(); + } + + public boolean isForCharField(CharField cf) { + return transaction.getCharFieldEnum() == cf.getCharFieldEnum(); + } } Modified: phenote/trunk/src/java/phenote/edit/EditManager.java =================================================================== --- phenote/trunk/src/java/phenote/edit/EditManager.java 2006-08-24 19:19:49 UTC (rev 99) +++ phenote/trunk/src/java/phenote/edit/EditManager.java 2006-08-25 18:27:12 UTC (rev 100) @@ -3,6 +3,14 @@ import java.util.ArrayList; import java.util.List; + +/** The way editing works is gui makes update transaction (see CharFieldGui and + AutoComboBox) and calls + EditManager.updateModel(), EM calls UpdateTrans constructs CharFieldValues and calls + CVF..editModel which call charFieldEnum.setValue which calls the appropriate + method in CharacterI. EM also shoots out char change event to its listeners + UpdateTrans takes Strings(for free text) or OBOClasses(ontologies). */ + public class EditManager { private static EditManager singleton; Modified: phenote/trunk/src/java/phenote/edit/UpdateTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/UpdateTransaction.java 2006-08-24 19:19:49 UTC (rev 99) +++ phenote/trunk/src/java/phenote/edit/UpdateTransaction.java 2006-08-25 18:27:12 UTC (rev 100) @@ -14,6 +14,7 @@ //private String oldValue; private CharFieldValue newValue; private CharFieldValue oldValue; + //private boolean undo? public UpdateTransaction(CharacterI c, CharFieldEnum e, String newVal, String old) { newValue = new CharFieldValue(newVal,c,e); @@ -36,6 +37,15 @@ //charFieldEnum.setValue(character,newValue); } + /** return new value for regular trans, old value for undo? */ + //String getValue() { // if undo } - does updateTrans know of undo??? not sure + + String getNewValueString() { return newValue.getName(); } + + CharFieldEnum getCharFieldEnum() { + return newValue.getCharFieldEnum(); + } + //public void undo() { oldValue.setValue();//charFieldEnum.setValue(character,oldValue); } } Modified: phenote/trunk/src/java/phenote/gui/AutoComboBox.java =================================================================== --- phenote/trunk/src/java/phenote/gui/AutoComboBox.java 2006-08-24 19:19:49 UTC (rev 99) +++ phenote/trunk/src/java/phenote/gui/AutoComboBox.java 2006-08-25 18:27:12 UTC (rev 100) @@ -426,20 +426,41 @@ //setTableFromField(ontology); } - /** edits Character field, sends out CharChangeEvent. + /** edits Character field via EditManager. checks that text in text field from user is actually an item in completion list, is an obo term. */ private void editCharField() { String input = getText(); if (input == null) return; // probably doesnt happen // the input should be from selected obo class shouldnt it? is it possible - // for this not to be so? + // for this not to be so? returns null if no oboclass? OBOClass oboClass = getSelectedCompListOboClass(); if (oboClass == null) return; /// happens on return on invalid term name + if (charField == null) return; // shouldnt happen + + CharacterI c = getSelectedCharacter(); + CharFieldEnum cfe = charField.getCharFieldEnum(); + UpdateTransaction ut = new UpdateTransaction(c,cfe,oboClass,previousOboClass); + EditManager.inst().updateModel(this,ut); + + previousOboClass = oboClass; // for undo + } + } + +} + +// GARBAGE + //t.editModel(); // or charField.editModel? + // CharacterChangeEvent e = new CharacterChangeEvent(t); + // OR CharEditManager.inst().updateModel(c,cfe,input,previousModelValue); + // CEM.handleTransaction(new UT), CEM.updateModel(UT) + // fireChangeEvent(e); + + // can this happen? yes when user hits return on text - actually i think this // is the test for being in the completion list isnt it? - boolean DEBUG = true; +// boolean DEBUG = true; // bug - on first return input is the user text not the term selected yet! // if (!input.equals(oboClass.getName())) { // if (DEBUG) @@ -454,29 +475,7 @@ // boolean valid = isInCompletionList(oboClass); //input); // if (!valid) // return; - - if (charField == null) // shouldnt happen - return; - - CharacterI c = getSelectedCharacter(); - CharFieldEnum cfe = charField.getCharFieldEnum(); - UpdateTransaction ut = new UpdateTransaction(c,cfe,oboClass,previousOboClass); - //t.editModel(); // or charField.editModel? - // CharacterChangeEvent e = new CharacterChangeEvent(t); - // OR CharEditManager.inst().updateModel(c,cfe,input,previousModelValue); - // CEM.handleTransaction(new UT), CEM.updateModel(UT) - EditManager.inst().updateModel(this,ut); - // fireChangeEvent(e); - - // for undo - previousOboClass = oboClass; - - } - } - -} - // /** Sets table value from field. checks that text in text field from user // is actually an item in completion list, is an obo term. */ // private void setTableFromField(String ontology) { Modified: phenote/trunk/src/java/phenote/gui/CharFieldGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharFieldGui.java 2006-08-24 19:19:49 UTC (rev 99) +++ phenote/trunk/src/java/phenote/gui/CharFieldGui.java 2006-08-25 18:27:12 UTC (rev 100) @@ -15,6 +15,8 @@ import phenote.datamodel.Ontology; import phenote.datamodel.OntologyManager; import phenote.datamodel.SearchParamsI; +import phenote.edit.CharChangeEvent; +import phenote.edit.CharChangeListener; import phenote.edit.EditManager; import phenote.edit.UpdateTransaction; import phenote.gui.selection.CharSelectionListener; @@ -42,10 +44,22 @@ else initCombo(charField,parent); - // do just for text field - or both??? + // do just for text field - or both??? listens for selection (eg from table) SelectionManager.inst().addCharSelectionListener(new FieldCharSelectListener()); + // listen for model changes (eg TermInfo commit) + + EditManager.inst().addCharChangeListener(new FieldCharChangeListener()); } + private class FieldCharChangeListener implements CharChangeListener { + public void charChanged(CharChangeEvent e) { + // check charField is this char field + if (e.isForCharField(charField)) + // i think all we need to do is setText to synch with model + setText(e.getValueString()); + } + } + AutoComboBox getAutoComboBox() { if (isCombo) return comboBox; @@ -55,6 +69,7 @@ // hasOntology? boolean isCombo() { return isCombo; } + /** Set the gui from the model */ void setValueFromChar(CharacterI character) { if (charField == null) return; if (charField.getCharFieldEnum() == null) { @@ -123,19 +138,19 @@ CharFieldEnum getCharFieldEnum() { return charField.getCharFieldEnum(); } // separate char text field class? - // this should be made generic to use beyond just genotype? yes yes yes - // and put in CharFieldGui... + /** This is where the model gets updated */ private class TextFieldDocumentListener implements DocumentListener { private String previousVal = null; - public void changedUpdate(DocumentEvent e) { updateInstanceTable(); } - public void insertUpdate(DocumentEvent e) { updateInstanceTable(); } - public void removeUpdate(DocumentEvent e) { updateInstanceTable(); } - private void updateInstanceTable() { + public void changedUpdate(DocumentEvent e) { updateModel(); } + public void insertUpdate(DocumentEvent e) { updateModel(); } + public void removeUpdate(DocumentEvent e) { updateModel(); } + private void updateModel() { // on delete last pheno row clearing of text will trigger this //if (!characterTablePanel.hasRows()) return; //String genotype = lumpField.getText(); //characterTablePanel.setSelectedGenotype(genotype); CharacterI c = SelectionManager.inst().getSelectedCharacter(); + // i believe this isnt using oboClass as we just have string String v = getText(); UpdateTransaction ut = new UpdateTransaction(c,getCharFieldEnum(),v,previousVal); EditManager.inst().updateModel(this,ut); Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-08-24 19:19:49 UTC (rev 99) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-08-25 18:27:12 UTC (rev 100) @@ -177,7 +177,7 @@ /** List/row selection listener - fired when user selects new row of table - refactor - this should send out CharacterSelectionEvent */ + notifies selectionManager of new char selection */ private class CharacterSelectionListener implements ListSelectionListener { public void valueChanged(ListSelectionEvent e) { if (!hasSelection()) // this can happen with a delete row Modified: phenote/trunk/src/java/phenote/gui/TermInfo.java =================================================================== --- phenote/trunk/src/java/phenote/gui/TermInfo.java 2006-08-24 19:19:49 UTC (rev 99) +++ phenote/trunk/src/java/phenote/gui/TermInfo.java 2006-08-25 18:27:12 UTC (rev 100) @@ -2,13 +2,17 @@ import java.net.URL; import java.util.Iterator; -//import java.util.Set; +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import javax.swing.BorderFactory; +import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JList; import javax.swing.JEditorPane; +import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.text.JTextComponent; @@ -22,13 +26,13 @@ import edu.stanford.ejalbert.exception.BrowserLaunchingInitializingException; import edu.stanford.ejalbert.exception.UnsupportedOperatingSystemException; -//import org.geneontology.oboedit.datamodel.Link; -//import org.geneontology.oboedit.datamodel.LinkedObject; import org.geneontology.oboedit.datamodel.OBOClass; -//import org.geneontology.oboedit.datamodel.OBOProperty; import phenote.datamodel.CharacterI; +import phenote.datamodel.CharField.CharFieldEnum; import phenote.datamodel.OntologyManager; +import phenote.edit.EditManager; +import phenote.edit.UpdateTransaction; import phenote.util.HtmlUtil; import phenote.gui.selection.SelectionManager; import phenote.gui.selection.TermSelectionEvent; @@ -38,29 +42,19 @@ //private JEditorPane textArea; private JTextComponent textArea; - //private static final boolean DO_HTML = false; private static final boolean DO_HTML = HtmlUtil.DO_HTML; - //static final String PHENOTE_LINK_PREFIX = "Phenote?id="; private TermHyperlinkListener termHyperlinkListener; // current obo class being navigated private OBOClass currentOboClass; + private OBOClass previousOboClass=null; // for undo - not implemented yet TermInfo(TermPanel termPanel) { - // do this more generically? some sort of controller? -// CompletionListListener l = new CompletionListListener(); -// termPanel.getEntityComboBox().addCompletionListListener(l); -// termPanel.getPatoComboBox().addCompletionListListener(l); -// if (termPanel.hasLumpComboBox()) -// termPanel.getLumpComboBox().addCompletionListListener(l); SelectionManager.inst().addTermSelectionListener(new InfoTermSelectionListener()); } JComponent getComponent() { - // JEditorPane allows for html formatting - bold... but doesnt do word wrap - bummer! - // as far as i can tell - // would have to explicitly put <br> in text. can also do hyperlinks! - // for now just doing JTextArea + JPanel termInfoPanel = new JPanel(new BorderLayout(0,0)); // hgap,vgap if (DO_HTML) { JEditorPane editorPane = new JEditorPane(); editorPane.setContentType("text/html"); // sets up HTMLEditorKit @@ -68,7 +62,7 @@ editorPane.addHyperlinkListener(termHyperlinkListener); textArea = editorPane; } - else { + else { // pase - delete? JTextArea jTextArea = new JTextArea(17,50); jTextArea.setLineWrap(true); jTextArea.setWrapStyleWord(true); @@ -80,9 +74,22 @@ scrollPane.setMaximumSize(new Dimension(400,300)); // border - make JPanel for it (there is a disclaimer about non JPanel) scrollPane.setBorder(BorderFactory.createTitledBorder("Term Info")); - return scrollPane; + termInfoPanel.add(scrollPane,BorderLayout.CENTER); + + JButton useTermButton = new JButton("Use Term"); + useTermButton.addActionListener(new UseTermActionListener()); + termInfoPanel.add(useTermButton,BorderLayout.SOUTH); + + return termInfoPanel; } + /** Commits currently browsed term when useTermButton is pressed */ + private class UseTermActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + commitTerm(); + } + } + // for TestPhenote String getText() { return textArea.getText(); } @@ -97,8 +104,7 @@ } - - + /** Listen for selection from phenote (mouse over completion list) */ private class InfoTermSelectionListener implements TermSelectionListener { public boolean termSelected(TermSelectionEvent e) { setTextFromOboClass(e.getOboClass()); @@ -106,10 +112,23 @@ } } - /** put present term into current character */ + /** put present term into current character - not used yet...*/ private void commitTerm() { CharacterI ch = SelectionManager.inst().getSelectedCharacter(); - // currentOboClass... + if (ch == null) { // can this happen? + System.out.println("ERROR: no character selected to update"); + return; + } + if (currentOboClass == null) { // can this happen? + System.out.println("ERROR: no term in term info to add to character"); + return; + } + + CharFieldEnum cfe = OntologyManager.inst().getCharFieldEnumForOboClass(currentOboClass); + + UpdateTransaction ut = new UpdateTransaction(ch,cfe,currentOboClass,previousOboClass); + EditManager.inst().updateModel(this,ut); + previousOboClass = currentOboClass; } /** for testing */ @@ -119,7 +138,7 @@ /** inner class TermHyperlink Listener, listens for clicks on term & external - hyper links and birngs up the term or brings up the external web page */ + hyper links and brings up the term or brings up the external web page */ private class TermHyperlinkListener implements HyperlinkListener { public void hyperlinkUpdate(HyperlinkEvent e) { @@ -131,7 +150,7 @@ // internal link to term... if (HtmlUtil.isPhenoteLink(e)) { - bringUpTermInPhenote(e); + bringUpTermInTermInfo(e); return; } @@ -142,11 +161,6 @@ bringUpInBrowser(url); - // ..... BrowserLauncher2? webstart BasicService? config browser... - // somehow distinguish local links from non local?? - // look for localhost? - - // set up localhost servlet? or just pick out text from url? - // hmmmmm...... } private void bringUpInBrowser(URL url) { @@ -164,27 +178,45 @@ } } + + private void bringUpTermInTermInfo(HyperlinkEvent e) { + // or do through obo session? + String id = HtmlUtil.getIdFromHyperlink(e); + if (id == null) return; + OBOClass term = OntologyManager.inst().getOboClass(id); + setTextFromOboClass(term); + } + } +} + + // JEditorPane allows for html formatting - bold... but doesnt do word wrap - bummer! + // as far as i can tell + // would have to explicitly put <br> in text. can also do hyperlinks! + // for now just doing JTextArea + // do this more generically? some sort of controller? +// CompletionListListener l = new CompletionListListener(); +// termPanel.getEntityComboBox().addCompletionListListener(l); +// termPanel.getPatoComboBox().addCompletionListListener(l); +// if (termPanel.hasLumpComboBox()) +// termPanel.getLumpComboBox().addCompletionListListener(l); + + // ..... BrowserLauncher2? webstart BasicService? config browser... + // somehow distinguish local links from non local?? + // look for localhost? - + // set up localhost servlet? or just pick out text from url? + // hmmmmm...... // private boolean isPhenoteLink(HyperlinkEvent e) { // return e.getURL() == null && e.getDescription().startsWith(PHENOTE_LINK_PREFIX); // } - private void bringUpTermInPhenote(HyperlinkEvent e) { // String desc = e.getDescription(); // if (desc == null || desc.equals("")) return; // String id = getIdFromDescription(desc); - // or do through obo session? - String id = HtmlUtil.getIdFromHyperlink(e); - if (id == null) return; - OBOClass term = OntologyManager.inst().getOboClass(id); - setTextFromOboClass(term); - } + // private String getIdFromDescription(String desc) { // return desc.substring(PHENOTE_LINK_PREFIX.length()); // } - } -} - // /** Listens for completion list selection (via moouse over) and populates // term info with term selected -- this is pase - replaced by // TermSelectionEvent/Listener */ Modified: phenote/trunk/src/java/phenote/util/HtmlUtil.java =================================================================== --- phenote/trunk/src/java/phenote/util/HtmlUtil.java 2006-08-24 19:19:49 UTC (rev 99) +++ phenote/trunk/src/java/phenote/util/HtmlUtil.java 2006-08-25 18:27:12 UTC (rev 100) @@ -49,6 +49,8 @@ if (definition != null && !definition.equals("")) sb.append(nl()).append(nl()).append(bold("Definition: ")).append(definition); + System.out.println(sb); + return sb.toString(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-24 19:19:59
|
Revision: 99 Author: mgibson Date: 2006-08-24 12:19:49 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=99&view=rev Log Message: ----------- got entity chooser working for stand alone - though layout could use a little work Modified Paths: -------------- phenote/trunk/conf/initial-flybase.cfg phenote/trunk/conf/initial-zfin.cfg phenote/trunk/conf/obd.cfg phenote/trunk/src/java/phenote/gui/AutoComboBox.java phenote/trunk/src/java/phenote/gui/CharFieldGui.java phenote/trunk/src/java/phenote/gui/TermPanel.java Modified: phenote/trunk/conf/initial-flybase.cfg =================================================================== --- phenote/trunk/conf/initial-flybase.cfg 2006-08-24 18:47:14 UTC (rev 98) +++ phenote/trunk/conf/initial-flybase.cfg 2006-08-24 19:19:49 UTC (rev 99) @@ -9,10 +9,12 @@ <field name="Genetic Context" file="context.obo"/> - <field name="Entity" file="fly_anatomy.obo"/> + <field name="Entity"> + <ontology name="Fly" file="fly_anatomy.obo" /> + <ontology name="GO" file="gene_ontology.obo"/> + </field> <field name="Quality" file="quality.obo"/> - </phenote-configuration> Modified: phenote/trunk/conf/initial-zfin.cfg =================================================================== --- phenote/trunk/conf/initial-zfin.cfg 2006-08-24 18:47:14 UTC (rev 98) +++ phenote/trunk/conf/initial-zfin.cfg 2006-08-24 19:19:49 UTC (rev 99) @@ -9,7 +9,7 @@ <field name="Genetic Context" file="context.obo"/> <field name="Entity"> - <ontology name="Anatomy" file="zebrafish_anatomy.obo" /> + <ontology name="ZF" file="zebrafish_anatomy.obo" /> <ontology name="GO" file="gene_ontology.obo"/> </field> Modified: phenote/trunk/conf/obd.cfg =================================================================== --- phenote/trunk/conf/obd.cfg 2006-08-24 18:47:14 UTC (rev 98) +++ phenote/trunk/conf/obd.cfg 2006-08-24 19:19:49 UTC (rev 99) @@ -3,11 +3,14 @@ <dataadapter name="phenosyntax"/> + <field name="Pub" /> + <field name="Genotype"/> <field name="Genetic Context" file="context.obo"/> <field name="Entity"> - <ontology name="Anatomy" file="fly_anatomy.obo" /> + <ontology name="Fly" file="fly_anatomy.obo" /> + <ontology name="ZF" file="zebrafish_anatomy.obo" /> <ontology name="GO" file="gene_ontology.obo"/> </field> Modified: phenote/trunk/src/java/phenote/gui/AutoComboBox.java =================================================================== --- phenote/trunk/src/java/phenote/gui/AutoComboBox.java 2006-08-24 18:47:14 UTC (rev 98) +++ phenote/trunk/src/java/phenote/gui/AutoComboBox.java 2006-08-24 19:19:49 UTC (rev 99) @@ -54,7 +54,7 @@ // this will probably throw errors if non metal look & feel is used setUI(new MetalListComboUI()); - this.ontology = ontology; + setOntology(ontology); searchParams = sp; // singleton access? part of ontology? setEditable(true); AutoTextFieldEditor autoTextFieldEditor = new AutoTextFieldEditor(); @@ -74,6 +74,8 @@ } + void setOntology(Ontology o) { ontology = o; } + //void setSearchParams(SearchParamsI sp) { searchParams = sp; } void setCharField(CharField charField) { this.charField = charField; } Modified: phenote/trunk/src/java/phenote/gui/CharFieldGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharFieldGui.java 2006-08-24 18:47:14 UTC (rev 98) +++ phenote/trunk/src/java/phenote/gui/CharFieldGui.java 2006-08-24 19:19:49 UTC (rev 99) @@ -1,5 +1,7 @@ package phenote.gui; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.Container; import javax.swing.JComboBox; import javax.swing.JLabel; @@ -11,6 +13,7 @@ import phenote.datamodel.CharField.CharFieldEnum; import phenote.datamodel.CharacterI; import phenote.datamodel.Ontology; +import phenote.datamodel.OntologyManager; import phenote.datamodel.SearchParamsI; import phenote.edit.EditManager; import phenote.edit.UpdateTransaction; @@ -20,27 +23,15 @@ /** fields can either be text fields for free text or combo boxes if have ontology to browse - CharFieldGui does either - with get/setText - hides the - details of the gui - just a filed that gives text - - make separate class? yes - rename CharFieldGuiGui? */ + details of the gui - just a field that gives text */ class CharFieldGui { private AutoComboBox comboBox; private JTextField textField; private boolean isCombo = false; private CharField charField; - //private SearchParamsI searchParams; private TermPanel termPanel; + private JComboBox ontologyChooserCombo; -// /** No ontology -> free text field */ -// private CharFieldGui(String label,Container parent) { -// initTextField(label,parent); -// } -// /** Fields with ontology -> combo box */ -// private CharFieldGui(Ontology ontology, Container parent) { -// if (ontology == null) // shouldnt happen -// initTextField(null,parent); -// else -// initCombo(ontology,parent); -// } CharFieldGui(CharField charField,Container parent, TermPanel tp) { this.charField = charField; @@ -76,14 +67,6 @@ setText(v); } -// private void initCombo(Ontology ontology, Container parent) { -// // attach search params to ontology? -// comboBox = new AutoComboBox(ontology,termPanel.getSearchParams()); -// // refactor... mvc - ACB talk directly to pheno model? -// //comboBox.addActionListener(new ComboBoxActionListener(ontology.getName(),comboBox)); -// //parent.add(comboBox,makeFieldConstraint()); -// termPanel.addFieldGui(comboBox,parent); -// } @@ -107,12 +90,13 @@ } private void initOntologyChooser(CharField charField,Container parent) { - JComboBox ontologyChooserCombo = new JComboBox(); + ontologyChooserCombo = new JComboBox(); // add listener.... for (Ontology o : charField.getOntologyList()) { ontologyChooserCombo.addItem(o.getName()); } - termPanel.addOntologyChooser(ontologyChooserCombo); + ontologyChooserCombo.addActionListener(new OntologyChooserListener()); + termPanel.addOntologyChooser(ontologyChooserCombo,parent); } private void initTextField(String label,Container parent) { @@ -125,10 +109,6 @@ termPanel.addFieldGui(textField,parent); } -// private void addDocumentListener(DocumentListener dl) { -// if (!isCombo) -// textField.getDocument().addDocumentListener(dl); -// } void setText(String text) { // set/getText interface to combo & text field? @@ -168,9 +148,43 @@ setValueFromChar(e.getCharacter()); } } + + private class OntologyChooserListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + String s = ontologyChooserCombo.getSelectedItem().toString(); + Ontology o = OntologyManager.getOntologyForName(s); + comboBox.setOntology(o); + } + } + } +// private void addDocumentListener(DocumentListener dl) { +// if (!isCombo) +// textField.getDocument().addDocumentListener(dl); +// } +// private void initCombo(Ontology ontology, Container parent) { +// // attach search params to ontology? +// comboBox = new AutoComboBox(ontology,termPanel.getSearchParams()); +// // refactor... mvc - ACB talk directly to pheno model? +// //comboBox.addActionListener(new ComboBoxActionListener(ontology.getName(),comboBox)); +// //parent.add(comboBox,makeFieldConstraint()); +// termPanel.addFieldGui(comboBox,parent); +// } + +// /** No ontology -> free text field */ +// private CharFieldGui(String label,Container parent) { +// initTextField(label,parent); +// } +// /** Fields with ontology -> combo box */ +// private CharFieldGui(Ontology ontology, Container parent) { +// if (ontology == null) // shouldnt happen +// initTextField(null,parent); +// else +// initCombo(ontology,parent); +// } + // /** Listens for actions from combo boxes and puts terms into table // * actions come from mouse select of term as well as return & tab // change this - should only modify character - could be done in ACB except Modified: phenote/trunk/src/java/phenote/gui/TermPanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/TermPanel.java 2006-08-24 18:47:14 UTC (rev 98) +++ phenote/trunk/src/java/phenote/gui/TermPanel.java 2006-08-24 19:19:49 UTC (rev 99) @@ -25,7 +25,7 @@ import phenote.config.FieldConfig; /** - * TermPanel holds all the fileds for the terms - Genotype, Entity/Anatomy, QUALITY. + * TermPanel holds all the fields for the terms - Genotype, Entity/Anatomy, QUALITY. * Can be populated by hand (Genotype), or selection of instance in completion list. rename FieldPanel or CharFieldPanel? also has SearchParamPanel. @@ -82,8 +82,8 @@ } /** if a field has more than one ontology than theres a combo to choose the ontology*/ - void addOntologyChooser(JComboBox ontologyChooser) { - + void addOntologyChooser(JComboBox ontologyChooser,Container parent) { + parent.add(ontologyChooser,makeOntologyChooserConstraint()); } void addFieldGui(JComponent comp,Container parent) { @@ -134,6 +134,10 @@ } } + + +// GARBAGE - DELETE + // load up terms for term completion /// Ontology.init(); // hmmmm.... now initializes with get - thread! //return entityField.getAutoComboBox(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-24 15:37:06
|
Revision: 97 Author: mgibson Date: 2006-08-24 08:36:49 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=97&view=rev Log Message: ----------- Added pub field to phenote - with pub configuration. this is for the trial data run for obd - once integrated with fly/zf dont think will need pub field - but good thing to be able to have - just free text. the config rnc enumerates the allowed fields in config - if bad field is configged then exits with error as i think it should. Modified Paths: -------------- phenote/trunk/conf/initial-flybase.cfg phenote/trunk/conf/initial-zfin.cfg phenote/trunk/conf/phenote-config.rnc phenote/trunk/conf/phenote-config.xsd phenote/trunk/jars/phenoteconfigbeans.jar phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java phenote/trunk/src/java/phenote/datamodel/CharField.java phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java phenote/trunk/src/java/phenote/datamodel/Character.java phenote/trunk/src/java/phenote/datamodel/CharacterI.java phenote/trunk/src/java/phenote/gui/CharacterTableModel.java phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java phenote/trunk/src/java/phenote/gui/Phenote.java Modified: phenote/trunk/conf/initial-flybase.cfg =================================================================== --- phenote/trunk/conf/initial-flybase.cfg 2006-08-24 15:33:36 UTC (rev 96) +++ phenote/trunk/conf/initial-flybase.cfg 2006-08-24 15:36:49 UTC (rev 97) @@ -1,8 +1,10 @@ <phenote-configuration version="0.7" xmlns="phenote/config/xml"> - <dataadapter name="phenosyntax"/> + <dataadapter name="phenosyntax"/> + <field name="Pub" /> + <field name="Genotype" type="free_text"/> <field name="Genetic Context" file="context.obo"/> Modified: phenote/trunk/conf/initial-zfin.cfg =================================================================== --- phenote/trunk/conf/initial-zfin.cfg 2006-08-24 15:33:36 UTC (rev 96) +++ phenote/trunk/conf/initial-zfin.cfg 2006-08-24 15:36:49 UTC (rev 97) @@ -2,6 +2,8 @@ <dataadapter name="phenosyntax"/> + <field name="Pub" /> + <field name="Genotype" type="free_text"/> <field name="Genetic Context" file="context.obo"/> Modified: phenote/trunk/conf/phenote-config.rnc =================================================================== --- phenote/trunk/conf/phenote-config.rnc 2006-08-24 15:33:36 UTC (rev 96) +++ phenote/trunk/conf/phenote-config.rnc 2006-08-24 15:36:49 UTC (rev 97) @@ -15,7 +15,7 @@ field = element field { - attribute name { text }, + attribute name { "Pub" | "Genotype" | "Genetic Context" | "Entity" | "Quality" }, ## whether field is free text or constrained by ontology - take out? ## this is actually unnecasary - if there is no file free text is assumed attribute type { "free_text" | "ontology" }, Modified: phenote/trunk/conf/phenote-config.xsd =================================================================== --- phenote/trunk/conf/phenote-config.xsd 2006-08-24 15:33:36 UTC (rev 96) +++ phenote/trunk/conf/phenote-config.xsd 2006-08-24 15:36:49 UTC (rev 97) @@ -12,7 +12,7 @@ <xs:complexType> <xs:attribute name="name" use="required"> <xs:annotation> - <xs:documentation>for now just 2 dataadapters, phenoxml & phenosyntax - more coming...</xs:documentation> + <xs:documentation>for now just 2 dataadapters, phenoxml & phenosyntax</xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> @@ -28,7 +28,17 @@ <xs:sequence> <xs:element minOccurs="0" maxOccurs="unbounded" ref="x:ontology"/> </xs:sequence> - <xs:attribute name="name" use="required"/> + <xs:attribute name="name" use="required"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="Pub"/> + <xs:enumeration value="Genotype"/> + <xs:enumeration value="Genetic Context"/> + <xs:enumeration value="Entity"/> + <xs:enumeration value="Quality"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> <xs:attribute name="type" use="required"> <xs:simpleType> <xs:restriction base="xs:token"> Modified: phenote/trunk/jars/phenoteconfigbeans.jar =================================================================== (Binary files differ) Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2006-08-24 15:33:36 UTC (rev 96) +++ phenote/trunk/src/java/phenote/config/Config.java 2006-08-24 15:36:49 UTC (rev 97) @@ -217,10 +217,12 @@ } catch (IOException ie) { - System.out.println("IOException on config parse "+ie); + System.out.println("EXITING! IOException on config parse "+ie); + System.exit(1); } catch (XmlException xe) { - System.out.println("Parse of config xml file failed "+xe); + System.out.println("EXITING! Parse of config xml file failed "+xe); + System.exit(1); } } @@ -235,13 +237,17 @@ private List<URL> getPossibleUrls(String filename) { List<URL> urls = new ArrayList(5); try { - urls.add(new File(filename).toURL()); - urls.add(new File("conf/"+filename).toURL()); + URL u = new File(filename).toURL(); + if (u != null) urls.add(u); + u = new File("conf/"+filename).toURL(); + if (u != null) urls.add(u); } catch (MalformedURLException e) { System.out.println("bad file url "+e); } - urls.add(Config.class.getResource(filename)); - urls.add(Config.class.getResource("/"+filename)); + URL jarUrl = Config.class.getResource(filename); + if (jarUrl != null) urls.add(jarUrl); + jarUrl = Config.class.getResource("/"+filename); + if (jarUrl != null) urls.add(jarUrl); return urls; } @@ -270,7 +276,7 @@ } private void makeFieldConfig(Field field) { - String name = field.getName().getStringValue(); + String name = field.getName().toString(); //String file = field.getFile().getStringValue(); // has to be a valid value CharFieldEnum cfe = CharFieldEnum.getCharFieldEnum(name); Modified: phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2006-08-24 15:33:36 UTC (rev 96) +++ phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2006-08-24 15:36:49 UTC (rev 97) @@ -36,13 +36,24 @@ return ""; //?? } StringBuffer sb = new StringBuffer(); + + if (character.hasPub()) + sb.append("PUB=").append(character.getPub()); // Genotype - not strictly part of pheno syntax but lets face it we need it // i would say its an omission from syntax - sb.append("GT= ").append(character.getGenotype()); + sb.append(" GT=").append(character.getGenotype()); if (character.hasGeneticContext()) - sb.append(" GC= ").append(idPrefixAndName(character.getGeneticContext())); - sb.append(" E= ").append(idPrefixAndName(character.getEntity())); - sb.append(" Q= ").append(idPrefixAndName(character.getQuality())); + sb.append(" GC=").append(idPrefixAndName(character.getGeneticContext())); + if (character.getEntity() == null) { + System.out.println("Error: character has no entity, ignoring"); + return ""; + } + sb.append(" E=").append(idPrefixAndName(character.getEntity())); + if (character.getQuality() == null) { + System.out.println("Error: character has no quality, ignoring"); + return ""; + } + sb.append(" Q=").append(idPrefixAndName(character.getQuality())); return sb.toString(); } @@ -56,6 +67,7 @@ /** for GO:12345 returns GO: - with colon! */ private String getIdPrefix(OBOClass term) { + if (term == null) return ""; // shouldnt happen String id = term.getID(); int colonIndex = id.indexOf(":"); return id.substring(0,colonIndex+1); // +1 retain colon Modified: phenote/trunk/src/java/phenote/datamodel/CharField.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharField.java 2006-08-24 15:33:36 UTC (rev 96) +++ phenote/trunk/src/java/phenote/datamodel/CharField.java 2006-08-24 15:36:49 UTC (rev 97) @@ -6,6 +6,7 @@ import org.geneontology.oboedit.datamodel.OBOClass; // or just Field? or CharField? eventually separate class? +// associates enum & ontologies public class CharField { // separate class? labels? methods? subclasses? @@ -13,6 +14,14 @@ // would it be nice to have a class that wrapped String and OBOClass? // and all possible field values? or would that be annoying? public enum CharFieldEnum { + PUB("Pub") { + public void setValue(CharacterI c, CharFieldValue v) { + c.setPub(v.getName()); + } + public CharFieldValue getValue(CharacterI c) { + return new CharFieldValue(c.getPub(),c,this); + } + }, LUMP("Genotype") { // genotype? default? public void setValue(CharacterI c, CharFieldValue v) { c.setGenotype(v.getName()); Modified: phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java 2006-08-24 15:33:36 UTC (rev 96) +++ phenote/trunk/src/java/phenote/datamodel/CharFieldValue.java 2006-08-24 15:36:49 UTC (rev 97) @@ -31,7 +31,8 @@ charFieldEnum = e; } - public String getName() { + // maybe this should be called getString??? why getName??? + public String getName() { if (!isOboClass) return stringValue; if (oboClassValue != null) // obo class may not be set yet @@ -41,7 +42,13 @@ OBOClass getOboClass() { return oboClassValue; } - public void editModel() { charFieldEnum.setValue(character,this); } + public void editModel() { + if (charFieldEnum == null) + System.out.println("ERROR no datamodel associated with configuration, cant set"+ + " value"); + else + charFieldEnum.setValue(character,this); + } public String toString() { return getName(); } } Modified: phenote/trunk/src/java/phenote/datamodel/Character.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/Character.java 2006-08-24 15:33:36 UTC (rev 96) +++ phenote/trunk/src/java/phenote/datamodel/Character.java 2006-08-24 15:36:49 UTC (rev 97) @@ -9,12 +9,15 @@ // private String entity=""; // private String quality=""; // private String geneticContext=""; + private String pub; private String genotype=""; // eventually Genotype class // OboClass? OntologyTerm?... private OBOClass entity; // CharFieldValue? private OBOClass quality; private OBOClass geneticContext; + public String getPub() { return pub; } + public boolean hasPub() { return pub!=null && !pub.equals(""); } public String getGenotype() { return genotype; } public OBOClass getEntity() { return entity; } public OBOClass getQuality() { return quality; } @@ -29,6 +32,7 @@ public String getGeneticContextName() { return geneticContext.getName(); } + public void setPub(String p ) { pub = p; } public void setGenotype(String gt) { genotype = gt; } public void setEntity(OBOClass e) { entity = e; } public void setQuality(OBOClass p) { quality = p; } Modified: phenote/trunk/src/java/phenote/datamodel/CharacterI.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharacterI.java 2006-08-24 15:33:36 UTC (rev 96) +++ phenote/trunk/src/java/phenote/datamodel/CharacterI.java 2006-08-24 15:36:49 UTC (rev 97) @@ -10,6 +10,8 @@ public String getQualityName(); // OBOClass? public String getGeneticContextName(); + public String getPub(); + public boolean hasPub(); public String getGenotype(); public OBOClass getEntity(); public OBOClass getQuality(); // OBOClass? @@ -17,6 +19,7 @@ public OBOClass getGeneticContext(); /** eventually have Genotype object? probably */ + public void setPub(String p); public void setGenotype(String gt); public void setEntity(OBOClass e); public void setQuality(OBOClass p); Modified: phenote/trunk/src/java/phenote/gui/CharacterTableModel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-08-24 15:33:36 UTC (rev 96) +++ phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-08-24 15:36:49 UTC (rev 97) @@ -95,6 +95,11 @@ public Object getValueAt(int row, int col) { CharacterI inst = getCharacter(row); + if (config.getCharFieldEnum(col) == null) { + System.out.println("Error column "+col+" not configured proplerly in "+ + "character table, cant retrieve value "); + return null; + } return config.getCharFieldEnum(col).getValue(inst).getName(); } Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-08-24 15:33:36 UTC (rev 96) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-08-24 15:36:49 UTC (rev 97) @@ -5,7 +5,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; - +import javax.swing.Box; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JScrollPane; @@ -39,6 +39,8 @@ private JButton commitButton; private int selectedRow; + // get from file menu? + private static final String SAVE_STRING = "Save data"; private boolean SANDBOX_MODE = true; // get from config... CharacterTablePanel(TermPanel tp) { @@ -72,7 +74,8 @@ deleteButton = addButton("Delete",al,buttonPanel); // should we only add if have data adapter - or disable at least? // should this go in a menu? - commitButton = addButton("Commit",al,buttonPanel); + buttonPanel.add(Box.createRigidArea(new Dimension(80,0))); + commitButton = addButton(SAVE_STRING,al,buttonPanel); add(buttonPanel); @@ -151,7 +154,7 @@ selectRow = characterTable.getRowCount()-1; // last row deleted } - else if (e.getActionCommand().equals("Commit")) { + else if (e.getActionCommand().equals(SAVE_STRING)) { Config c = Config.inst(); if (!c.hasSingleDataAdapter()) { System.out.println("Cant commit. No data adapter configged"); Modified: phenote/trunk/src/java/phenote/gui/Phenote.java =================================================================== --- phenote/trunk/src/java/phenote/gui/Phenote.java 2006-08-24 15:33:36 UTC (rev 96) +++ phenote/trunk/src/java/phenote/gui/Phenote.java 2006-08-24 15:36:49 UTC (rev 97) @@ -16,7 +16,7 @@ public class Phenote { - private static final String VERSION = "0.7 dev"; + private static final String VERSION = "0.7.1 dev"; //private static final String DEFAULT_CONFIG_FILE = Config.DEFAULT_CONFIG_FILE; private CharacterTablePanel characterTablePanel; @@ -34,6 +34,7 @@ catch (UnsupportedLookAndFeelException e) { System.out.println("Failed to set to Java/Metal look & feel"); } + //System.out.println("sys CONFIG prop "+System.getProperty("CONFIG")); phenote = getPhenote(); phenote.initConfig(args); phenote.initOntologies(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-24 15:33:46
|
Revision: 96 Author: mgibson Date: 2006-08-24 08:33:36 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=96&view=rev Log Message: ----------- added ability to run different config file ant fly ant zfin ant obd and also specify config file from ant ant run-conf -DCONF_FILE=myconf.cfg Modified Paths: -------------- phenote/trunk/build.xml Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2006-08-22 21:51:17 UTC (rev 95) +++ phenote/trunk/build.xml 2006-08-24 15:33:36 UTC (rev 96) @@ -25,6 +25,8 @@ <property name="jarfile" value="jars/phenote.jar"/> <property name="obo" value="obo-files" /> <property name="conf" value="conf" /> + <!-- override this from command line with -DCONF-FILE=initial-zfin.cfg --> + <property name="CONF_FILE" value="initial-flybase.cfg"/> <!-- The init target makes sure that the prerequisite directories exist. --> <target name="init"> @@ -81,6 +83,68 @@ </java> </target> + <target name="zfin" depends="compile"> + <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <!-- arg value="-c configfilehereventually"/ --> + <arg value="-c"/> + <arg value="initial-zfin.cfg"/> + <classpath> + <pathelement path="${classfiles}"/> + <fileset dir="${lib}"> + <include name="*.jar"/> + <exclude name="phenote.jar"/> + </fileset> + </classpath> + </java> + </target> + + <target name="fly" depends="compile"> + <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <!-- arg value="-c configfilehereventually"/ --> + <arg value="-c"/> + <arg value="initial-flybase.cfg"/> + <classpath> + <pathelement path="${classfiles}"/> + <fileset dir="${lib}"> + <include name="*.jar"/> + <exclude name="phenote.jar"/> + </fileset> + </classpath> + </java> + </target> + + <target name="obd" depends="compile"> + <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <!-- arg value="-c configfilehereventually"/ --> + <arg value="-c"/> + <arg value="obd.cfg"/> + <classpath> + <pathelement path="${classfiles}"/> + <fileset dir="${lib}"> + <include name="*.jar"/> + <exclude name="phenote.jar"/> + </fileset> + </classpath> + </java> + </target> + + <target name="run-conf" depends="compile"> + <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> + <!-- arg value="-c configfilehereventually"/ --> + <arg value="-c"/> + <arg value="${CONF_FILE}"/> + <classpath> + <pathelement path="${classfiles}"/> + <fileset dir="${lib}"> + <include name="*.jar"/> + <exclude name="phenote.jar"/> + </fileset> + </classpath> + </java> + </target> + + + <target name="test" depends="build-test"> <java classname="org.junit.runner.JUnitCore" fork="yes"> <arg value="phenote.gui.TestPhenote"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-22 21:51:34
|
Revision: 95 Author: mgibson Date: 2006-08-22 14:51:17 -0700 (Tue, 22 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=95&view=rev Log Message: ----------- got pheno syntax data adapter working for writeback config file now takes phenosyntax for data adapter Modified Paths: -------------- phenote/trunk/conf/initial-flybase.cfg phenote/trunk/conf/initial-zfin.cfg phenote/trunk/conf/obd.cfg phenote/trunk/conf/phenote-config.rnc phenote/trunk/conf/phenote-config.xsd phenote/trunk/jars/phenoteconfigbeans.jar phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java phenote/trunk/src/java/phenote/datamodel/CharacterListI.java Modified: phenote/trunk/conf/initial-flybase.cfg =================================================================== --- phenote/trunk/conf/initial-flybase.cfg 2006-08-22 18:22:10 UTC (rev 94) +++ phenote/trunk/conf/initial-flybase.cfg 2006-08-22 21:51:17 UTC (rev 95) @@ -1,7 +1,7 @@ <phenote-configuration version="0.7" xmlns="phenote/config/xml"> - <data-adapter name="phenoxml"/> + <dataadapter name="phenosyntax"/> <field name="Genotype" type="free_text"/> Modified: phenote/trunk/conf/initial-zfin.cfg =================================================================== --- phenote/trunk/conf/initial-zfin.cfg 2006-08-22 18:22:10 UTC (rev 94) +++ phenote/trunk/conf/initial-zfin.cfg 2006-08-22 21:51:17 UTC (rev 95) @@ -1,6 +1,6 @@ <phenote-configuration version="0.7" xmlns="phenote/config/xml"> - <data-adapter name="phenoxml"/> + <dataadapter name="phenosyntax"/> <field name="Genotype" type="free_text"/> Modified: phenote/trunk/conf/obd.cfg =================================================================== --- phenote/trunk/conf/obd.cfg 2006-08-22 18:22:10 UTC (rev 94) +++ phenote/trunk/conf/obd.cfg 2006-08-22 21:51:17 UTC (rev 95) @@ -1,7 +1,7 @@ <phenote-configuration version="0.7" xmlns="phenote/config/xml"> - <data-adapter name="phenoxml"/> + <dataadapter name="phenosyntax"/> <field name="Genetic Context" file="context.obo"/> Modified: phenote/trunk/conf/phenote-config.rnc =================================================================== --- phenote/trunk/conf/phenote-config.rnc 2006-08-22 18:22:10 UTC (rev 94) +++ phenote/trunk/conf/phenote-config.rnc 2006-08-22 21:51:17 UTC (rev 95) @@ -9,8 +9,8 @@ dataadapter = element dataadapter { - ## for now only one dataadapter, phenoxml - more coming... - attribute name { "phenoxml" } + ## for now just 2 dataadapters, phenoxml & phenosyntax + attribute name {"phenoxml" | "phenosyntax"} } field = @@ -18,7 +18,7 @@ attribute name { text }, ## whether field is free text or constrained by ontology - take out? ## this is actually unnecasary - if there is no file free text is assumed - attribute type { "free_text", "ontology" }, + attribute type { "free_text" | "ontology" }, ## file is for single ontology - rename ontology_file? attribute file { text }, ontology* Modified: phenote/trunk/conf/phenote-config.xsd =================================================================== --- phenote/trunk/conf/phenote-config.xsd 2006-08-22 18:22:10 UTC (rev 94) +++ phenote/trunk/conf/phenote-config.xsd 2006-08-22 21:51:17 UTC (rev 95) @@ -12,11 +12,12 @@ <xs:complexType> <xs:attribute name="name" use="required"> <xs:annotation> - <xs:documentation>for now only one dataadapter, phenoxml - more coming...</xs:documentation> + <xs:documentation>for now just 2 dataadapters, phenoxml & phenosyntax - more coming...</xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="phenoxml"/> + <xs:enumeration value="phenosyntax"/> </xs:restriction> </xs:simpleType> </xs:attribute> @@ -29,9 +30,6 @@ </xs:sequence> <xs:attribute name="name" use="required"/> <xs:attribute name="type" use="required"> - <xs:annotation> - <xs:documentation>whether field is free text or constrained by ontology</xs:documentation> - </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="free_text"/> Modified: phenote/trunk/jars/phenoteconfigbeans.jar =================================================================== (Binary files differ) Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2006-08-22 18:22:10 UTC (rev 94) +++ phenote/trunk/src/java/phenote/config/Config.java 2006-08-22 21:51:17 UTC (rev 95) @@ -28,6 +28,7 @@ import phenote.datamodel.CharField.CharFieldEnum; import phenote.dataadapter.DataAdapterI; import phenote.dataadapter.fly.FlybaseDataAdapter; +import phenote.dataadapter.phenosyntax.PhenoSyntaxFileAdapter; import phenote.dataadapter.phenoxml.PhenoXmlAdapter; public class Config { @@ -254,10 +255,12 @@ // do some other way? DataAdapterManager has mapping? DataAdapter has mapping? // DataAdapterManager.getAdapter(name)??? private void addDataAdapterFromString(String daString) { - if (daString.equalsIgnoreCase("flybase")) + if (daString.equalsIgnoreCase("phenoxml")) + addDataAdapter(new PhenoXmlAdapter()); + else if (daString.equalsIgnoreCase("phenosyntax")) + addDataAdapter(new PhenoSyntaxFileAdapter()); + else if (daString.equalsIgnoreCase("flybase")) // pase?? addDataAdapter(new FlybaseDataAdapter()); // for now... - else if (daString.equalsIgnoreCase("phenoxml")) - addDataAdapter(new PhenoXmlAdapter()); } private void addDataAdapter(DataAdapterI da) { Modified: phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2006-08-22 18:22:10 UTC (rev 94) +++ phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxChar.java 2006-08-22 21:51:17 UTC (rev 95) @@ -8,8 +8,12 @@ CharacterI. It can make a phenosyntax string from a CharacterI and make a CharacterI from a phenosyntax string e.g. E=head Q=large See http://www.fruitfly.org/~cjm/obd/pheno-syntax.html for a full description - of pheno syntax.*/ + of pheno syntax. + Phenote additions: syntax doesnt do genotype or genetic context but heck we + need them - so i added GT=genotype (do we gen context?) GC=geneticContext +*/ + public class PhenoSyntaxChar { private CharacterI character; @@ -32,12 +36,15 @@ return ""; //?? } StringBuffer sb = new StringBuffer(); - sb.append("E= ").append(idPrefixAndName(character.getEntity())); - //sb.append + // Genotype - not strictly part of pheno syntax but lets face it we need it + // i would say its an omission from syntax + sb.append("GT= ").append(character.getGenotype()); + if (character.hasGeneticContext()) + sb.append(" GC= ").append(idPrefixAndName(character.getGeneticContext())); + sb.append(" E= ").append(idPrefixAndName(character.getEntity())); + sb.append(" Q= ").append(idPrefixAndName(character.getQuality())); - // work in progress - abandoned for pheno xml adapter - revisit for flybase... - - return null; + return sb.toString(); } /** Merges id prefix and name, so for id GO:1234 with name "growth" returns @@ -51,7 +58,7 @@ private String getIdPrefix(OBOClass term) { String id = term.getID(); int colonIndex = id.indexOf(":"); - return id.substring(colonIndex); + return id.substring(0,colonIndex+1); // +1 retain colon } } Modified: phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java 2006-08-22 18:22:10 UTC (rev 94) +++ phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java 2006-08-22 21:51:17 UTC (rev 95) @@ -1,7 +1,15 @@ package phenote.dataadapter.phenosyntax; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; + +import phenote.datamodel.CharacterI; import phenote.datamodel.CharacterListI; import phenote.dataadapter.DataAdapterI; +import phenote.dataadapter.phenoxml.PhenoXmlAdapter; /** Writes pheno syntax characters to a file. See http://www.fruitfly.org/~cjm/obd/pheno-syntax.html for a full description @@ -14,6 +22,24 @@ public void commit(CharacterListI charList) { + File file = PhenoXmlAdapter.getFile(); // perhaps a util class + if (file == null) + return; + + PrintWriter pw; + try { + pw = new PrintWriter(new BufferedWriter(new FileWriter(file))); + } catch (IOException e) { + System.out.println("Failed to open file "+file); + return; + } + + for (CharacterI ch : charList.getList()) { + String c = new PhenoSyntaxChar(ch).getPhenoSyntaxString(); + System.out.println(c); + pw.println(c); + } + pw.close(); } } Modified: phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java 2006-08-22 18:22:10 UTC (rev 94) +++ phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java 2006-08-22 21:51:17 UTC (rev 95) @@ -41,7 +41,8 @@ Phenoset phenoset = doc.addNewPhenoset(); for (CharacterI chr : charList.getList()) { - writeCharacterAndGenotype(chr,phenoset); + // builds Phenoset from characters + addCharAndGenotypeToPhenoset(chr,phenoset); } System.out.println("doc schme type "+doc.schemaType()+" name "+doc.schemaType().getName()); @@ -55,7 +56,7 @@ } } - private File getFile() { + public static File getFile() { // todo - remember last accessed dir JFileChooser fileChooser = new JFileChooser(); // todo - file filter - only .xml or .phenoxml? @@ -76,7 +77,7 @@ } - private void writeCharacterAndGenotype(CharacterI chr, Phenoset phenoset) { + private void addCharAndGenotypeToPhenoset(CharacterI chr, Phenoset phenoset) { String genotype = chr.getGenotype(); PhenotypeManifestation pm = phenoset.addNewPhenotypeManifestation(); addGenotype(genotype,phenoset,pm); Modified: phenote/trunk/src/java/phenote/datamodel/CharacterListI.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharacterListI.java 2006-08-22 18:22:10 UTC (rev 94) +++ phenote/trunk/src/java/phenote/datamodel/CharacterListI.java 2006-08-22 21:51:17 UTC (rev 95) @@ -4,7 +4,8 @@ /** holds a list of Characters - rename phenotype? i dont think so - can have multiple genotypes in it - transfreable allows it to be plopped on the - clipboard */ + clipboard +hmmm isnt this just a List<CharacterI>? */ public interface CharacterListI { public CharacterI get(int i); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-22 18:22:16
|
Revision: 94 Author: mgibson Date: 2006-08-22 11:22:10 -0700 (Tue, 22 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=94&view=rev Log Message: ----------- added new phenote-config.rnc and xsd for config xml. xsd is actually generated from rnc with trang but no harm in adding it i suppose. phenoteconfigbeans.jar is auto generated from .xsd with xml beans scomp which is then used to parse config file Added Paths: ----------- phenote/trunk/conf/phenote-config.rnc phenote/trunk/conf/phenote-config.xsd Added: phenote/trunk/conf/phenote-config.rnc =================================================================== --- phenote/trunk/conf/phenote-config.rnc (rev 0) +++ phenote/trunk/conf/phenote-config.rnc 2006-08-22 18:22:10 UTC (rev 94) @@ -0,0 +1,32 @@ +default namespace = "phenote/config/xml" +##default namespace = "http://phenote/config/xml" + +start = + element phenote-configuration { + dataadapter*, + field* + } + +dataadapter = + element dataadapter { + ## for now only one dataadapter, phenoxml - more coming... + attribute name { "phenoxml" } + } + +field = + element field { + attribute name { text }, + ## whether field is free text or constrained by ontology - take out? + ## this is actually unnecasary - if there is no file free text is assumed + attribute type { "free_text", "ontology" }, + ## file is for single ontology - rename ontology_file? + attribute file { text }, + ontology* + } + +ontology = + element ontology { + attribute name { text }, + ## obo file for ontology + attribute file { text } + } Added: phenote/trunk/conf/phenote-config.xsd =================================================================== --- phenote/trunk/conf/phenote-config.xsd (rev 0) +++ phenote/trunk/conf/phenote-config.xsd 2006-08-22 18:22:10 UTC (rev 94) @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="phenote/config/xml" xmlns:x="phenote/config/xml"> + <xs:element name="phenote-configuration"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="x:dataadapter"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="x:field"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="dataadapter"> + <xs:complexType> + <xs:attribute name="name" use="required"> + <xs:annotation> + <xs:documentation>for now only one dataadapter, phenoxml - more coming...</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="phenoxml"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:complexType> + </xs:element> + <xs:element name="field"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="x:ontology"/> + </xs:sequence> + <xs:attribute name="name" use="required"/> + <xs:attribute name="type" use="required"> + <xs:annotation> + <xs:documentation>whether field is free text or constrained by ontology</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="free_text"/> + <xs:enumeration value="ontology"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="file" use="required"> + <xs:annotation> + <xs:documentation>file is for single ontology - rename ontology_file? </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + </xs:element> + <xs:element name="ontology"> + <xs:complexType> + <xs:attribute name="name" use="required"/> + <xs:attribute name="file" use="required"> + <xs:annotation> + <xs:documentation>obo file for ontology</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + </xs:element> +</xs:schema> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-22 18:19:55
|
Revision: 93 Author: mgibson Date: 2006-08-22 11:19:35 -0700 (Tue, 22 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=93&view=rev Log Message: ----------- refactored configuration now does generic fields rather than specific entity, genetic context elements using xml beans to parse config instead of DOM uses phenoteconfigbeans jar generated from xsd from rnc for phenote config (ill commit those in a second) "pato" changed to "Quality" fixed test suite with new quality ontology Modified Paths: -------------- phenote/trunk/build.xml phenote/trunk/conf/initial-flybase.cfg phenote/trunk/conf/initial-zfin.cfg phenote/trunk/conf/obd.cfg phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/dataadapter/fly/FlyCharacter.java phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java phenote/trunk/src/java/phenote/datamodel/CharField.java phenote/trunk/src/java/phenote/datamodel/Character.java phenote/trunk/src/java/phenote/datamodel/CharacterI.java phenote/trunk/src/java/phenote/gui/CharFieldGui.java phenote/trunk/src/java/phenote/gui/Phenote.java phenote/trunk/src/java/phenote/gui/TermPanel.java phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java phenote/trunk/src/java/test/phenote/gui/TestPhenote.java Added Paths: ----------- phenote/trunk/jars/phenoteconfigbeans.jar Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2006-08-21 15:49:04 UTC (rev 92) +++ phenote/trunk/build.xml 2006-08-22 18:19:35 UTC (rev 93) @@ -241,7 +241,16 @@ </war> </target> + <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpath="${lib}/xbean.jar" /> +<!-- classgendir="${build.dir}" - if not doing jar but classes, schema is directory +where xsd files are (conf) --> + <target name="xml-beans"> + <xmlbean schema="${conf}" destfile="${lib}/phenotexmlbeans.jar" classpath="${project.classpath3}" + failonerror="true" javasource="1.5" > + </xmlbean> + </target> + </project> Modified: phenote/trunk/conf/initial-flybase.cfg =================================================================== --- phenote/trunk/conf/initial-flybase.cfg 2006-08-21 15:49:04 UTC (rev 92) +++ phenote/trunk/conf/initial-flybase.cfg 2006-08-22 18:19:35 UTC (rev 93) @@ -1,14 +1,16 @@ -<phenote-configuration version="0.6"> +<phenote-configuration version="0.7" xmlns="phenote/config/xml"> <data-adapter name="phenoxml"/> - <genetic-context file="context.obo"/> + <field name="Genotype" type="free_text"/> - <entity name="Anatomy" file="fly_anatomy.obo"/> + <field name="Genetic Context" file="context.obo"/> - <pato file="quality.obo"/> + <field name="Entity" file="fly_anatomy.obo"/> + <field name="Quality" file="quality.obo"/> + </phenote-configuration> Modified: phenote/trunk/conf/initial-zfin.cfg =================================================================== --- phenote/trunk/conf/initial-zfin.cfg 2006-08-21 15:49:04 UTC (rev 92) +++ phenote/trunk/conf/initial-zfin.cfg 2006-08-22 18:19:35 UTC (rev 93) @@ -1,15 +1,17 @@ -<phenote-configuration version="0.6"> +<phenote-configuration version="0.7" xmlns="phenote/config/xml"> <data-adapter name="phenoxml"/> - <genetic-context file="context.obo"/> + <field name="Genotype" type="free_text"/> - <entity name="Entity"> + <field name="Genetic Context" file="context.obo"/> + + <field name="Entity"> <ontology name="Anatomy" file="zebrafish_anatomy.obo" /> <ontology name="GO" file="gene_ontology.obo"/> - </entity> + </field> - <pato file="quality.obo"/> + <field name="Quality" file="quality.obo"/> Modified: phenote/trunk/conf/obd.cfg =================================================================== --- phenote/trunk/conf/obd.cfg 2006-08-21 15:49:04 UTC (rev 92) +++ phenote/trunk/conf/obd.cfg 2006-08-22 18:19:35 UTC (rev 93) @@ -1,17 +1,16 @@ -<phenote-configuration version="0.4"> +<phenote-configuration version="0.7" xmlns="phenote/config/xml"> <data-adapter name="phenoxml"/> - <genetic-context file="context.obo"/> - <entity name="Entity"> + <field name="Genetic Context" file="context.obo"/> + + <field name="Entity"> <ontology name="Anatomy" file="fly_anatomy.obo" /> <ontology name="GO" file="gene_ontology.obo"/> - </entity> + </field> - <pato file="quality.obo"/> + <field name="Quality" file="quality.obo"/> - - </phenote-configuration> Added: phenote/trunk/jars/phenoteconfigbeans.jar =================================================================== (Binary files differ) Property changes on: phenote/trunk/jars/phenoteconfigbeans.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2006-08-21 15:49:04 UTC (rev 92) +++ phenote/trunk/src/java/phenote/config/Config.java 2006-08-22 18:19:35 UTC (rev 93) @@ -1,9 +1,11 @@ package phenote.config; import java.io.IOException; +import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.List; +import java.net.MalformedURLException; import java.net.URL; import javax.xml.parsers.DocumentBuilder; @@ -15,6 +17,14 @@ import org.w3c.dom.NodeList; import org.xml.sax.SAXException; +import org.apache.xmlbeans.XmlException; +// in phenoteconfigbeans.jar code generate xml beans +import phenote.config.xml.PhenoteConfigurationDocument; +import phenote.config.xml.PhenoteConfigurationDocument.PhenoteConfiguration; +import phenote.config.xml.DataadapterDocument.Dataadapter; +import phenote.config.xml.FieldDocument.Field; +import phenote.config.xml.OntologyDocument.Ontology; + import phenote.datamodel.CharField.CharFieldEnum; import phenote.dataadapter.DataAdapterI; import phenote.dataadapter.fly.FlybaseDataAdapter; @@ -27,13 +37,14 @@ private String configFile = DEFAULT_CONFIG_FILE; //private String patoFile = "attribute_and_values.obo"; // default value //private OntologyConfig patoConfig; - private FieldConfig patoConfig; + //private FieldConfig patoConfig; private FieldConfig lumpConfig = new FieldConfig(CharFieldEnum.LUMP,"Genotype"); //private String lumpOntologyFile = null; private OntologyConfig lumpConfig = new OntologyConfig("Genotype"); //private List<OntologyConfig> entityConfigList = new ArrayList<OntologyConfig>(); - private FieldConfig entityConfig; - private FieldConfig geneticContextConfig; + //private FieldConfig entityConfig; + //private FieldConfig geneticContextConfig; private List<DataAdapterI> dataAdapterList; + private List<FieldConfig> fieldList = new ArrayList<FieldConfig>(); /** singleton */ private Config() { @@ -43,7 +54,8 @@ public void setConfigFile(String configFile) { this.configFile = configFile; // ?? System.out.println("Attempting to read config from "+configFile); - parseXmlFile(configFile); // do parse here? + //parseXmlFileWithDom(configFile); // do parse here? + parseXmlFile(configFile); } public static Config inst() { @@ -84,48 +96,48 @@ return lumpConfig.getOntologyConfig(); } - public OntologyConfig getPatoOntologyConfig() { - return getPatoConfig().getOntologyConfig(); - } +// public OntologyConfig getPatoOntologyConfig() { +// return getPatoConfig().getOntologyConfig(); +// } /** paot config should always be present, make default if not set from xml */ - private FieldConfig getPatoConfig() { - if (patoConfig == null) { - System.out.println("error pato config is null, making default"); - OntologyConfig o = OntologyConfig.defaultPato; - patoConfig = new FieldConfig(CharFieldEnum.PATO,o); - } - return patoConfig; - } +// private FieldConfig getPatoConfig() { +// if (patoConfig == null) { +// System.out.println("error pato config is null, making default"); +// OntologyConfig o = OntologyConfig.defaultPato; +// patoConfig = new FieldConfig(CharFieldEnum.PATO,o); +// } +// return patoConfig; +// } - public boolean hasGeneticContextField() { - return geneticContextConfig != null; - } +// public boolean hasGeneticContextField() { +// return geneticContextConfig != null; +// } - public OntologyConfig getGeneticContextOntologyConfig() { - if (!hasGeneticContextField()) return null; - return getGeneticContextConfig().getOntologyConfig(); // check if has ont? - } +// public OntologyConfig getGeneticContextOntologyConfig() { +// if (!hasGeneticContextField()) return null; +// return getGeneticContextConfig().getOntologyConfig(); // check if has ont? +// } - public FieldConfig getGeneticContextConfig() { - return geneticContextConfig; - } +// public FieldConfig getGeneticContextConfig() { +// return geneticContextConfig; +// } - private void initGeneticContextConfig(OntologyConfig oc) { - geneticContextConfig = new FieldConfig(CharFieldEnum.GENETIC_CONTEXT,oc); - } +// private void initGeneticContextConfig(OntologyConfig oc) { +// geneticContextConfig = new FieldConfig(CharFieldEnum.GENETIC_CONTEXT,oc); +// } - private FieldConfig getEntityConfig() { - if (entityConfig == null) - entityConfig = new FieldConfig(CharFieldEnum.ENTITY,"Entity"); - return entityConfig; - } +// private FieldConfig getEntityConfig() { +// if (entityConfig == null) +// entityConfig = new FieldConfig(CharFieldEnum.ENTITY,"Entity"); +// return entityConfig; +// } - public List<OntologyConfig> getEntityOntologyConfigs() { -// if (entityConfigList.isEmpty()) entityConfigList = defaultEntityConfigList(); -// return entityConfigList; - return getEntityConfig().getOntologyConfigList(); - } +// public List<OntologyConfig> getEntityOntologyConfigs() { +// // if (entityConfigList.isEmpty()) entityConfigList = defaultEntityConfigList(); +// // return entityConfigList; +// return getEntityConfig().getOntologyConfigList(); +// } public int getNumberOfFields() { return getFieldConfigList().size(); @@ -144,34 +156,35 @@ return getFieldConfig(index).getCharFieldEnum(); } + /** needed for getFieldLabel for table */ private FieldConfig getFieldConfig(int index) { return getFieldConfigList().get(index); } - private List<FieldConfig> fieldList; + /** OntologyDataAdapter calls this to figure which ontologies to load */ public List<FieldConfig> getFieldConfigList() { - if (fieldList == null) - initFieldConfigList(); +// if (fieldList == null) +// initFieldConfigList(); return fieldList; } - // refactor! - just have it come straight from xml parse! - private void initFieldConfigList() { - fieldList = new ArrayList<FieldConfig>(); - if (hasLumpField()) { - fieldList.add(getLumpConfig()); - } - if (hasGeneticContextField()) { - fieldList.add(getGeneticContextConfig()); - } - // entity config should always be present shouldnt it? - fieldList.add(getEntityConfig()); - fieldList.add(getPatoConfig()); // pato required - } +// // refactor! - just have it come straight from xml parse! +// private void initFieldConfigList() { +// //fieldList = new ArrayList<FieldConfig>(); +// if (hasLumpField()) { +// fieldList.add(getLumpConfig()); +// } +// if (hasGeneticContextField()) { +// fieldList.add(getGeneticContextConfig()); +// } +// // entity config should always be present shouldnt it? +// fieldList.add(getEntityConfig()); +// fieldList.add(getPatoConfig()); // pato required +// } - /** Default entity list is the anatomy ontology */ + /** Default entity list is the anatomy ontology -- DELETE*/ private List<OntologyConfig> defaultEntityConfigList() { OntologyConfig oc = new OntologyConfig("Anatomy","anatomy.obo"); List<OntologyConfig> l = new ArrayList<OntologyConfig>(1); @@ -179,190 +192,284 @@ return l; } - /** Throws ParserConfig,SAXEx, & IOException if problems - sep class? */ - private Document getDocument(String filename) throws Exception { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = dbf.newDocumentBuilder(); - Document document = tryFile(builder,filename); - if (document == null) - document = tryFile(builder,"conf/"+filename); - if (document == null) { // try jar file - URL url = Config.class.getResource(filename); - if (url == null) - System.out.println("failed to get file from jar without '/' prepend"); - else - document = tryFile(builder,url.toString()); + + /** parse xml file with xml beans (phenoteconfigbeans.xml). Put in own class? */ + private void parseXmlFile(String filename) { + try { + URL configUrl = getConfigUrl(filename); + System.out.println("config file: "+configUrl); + PhenoteConfigurationDocument pcd = + PhenoteConfigurationDocument.Factory.parse(configUrl);//configFile); + PhenoteConfiguration pc = pcd.getPhenoteConfiguration(); + Dataadapter[] adapters = pc.getDataadapterArray(); + for (Dataadapter da : adapters) { + String name = da.getName().toString(); + addDataAdapterFromString(name); + } + + Field[] fields = pc.getFieldArray(); + for (Field f : fields) { + //String name = f.getName().getStringValue(); + //String file = f.getFile().getStringValue(); + makeFieldConfig(f); + } + } - // hmmmm - so ontology data adapter prepends "/" for jar file but above - // doesnt (which seems to work for web start but not jboss) try with - // prepended slash as well - what the heck - // its true this works for jboss - above for webstart - very strange - if (document == null) { - URL url = Config.class.getResource("/"+filename); - if (url == null) - System.out.println("failed to get file from jar with '/' prepend"); - else - document = tryFile(builder,url.toString()); + catch (IOException ie) { + System.out.println("IOException on config parse "+ie); } - - if (document == null) { - System.out.println("Failed to find config file "+filename); - throw new FileNotFoundException(filename); + catch (XmlException xe) { + System.out.println("Parse of config xml file failed "+xe); } - return document; } - /** Returns null if cant find file, throws exception if parse fails */ - private Document tryFile(DocumentBuilder builder, String uri) throws Exception { - if (uri == null) return null; - Document document = null; + private URL getConfigUrl(String filename) throws FileNotFoundException { + List<URL> possibleUrls = getPossibleUrls(filename); + for (URL u : possibleUrls) + if (urlExists(u)) return u; + System.out.println("Failed to find file "+filename); + throw new FileNotFoundException(filename+" not found"); + } + + private List<URL> getPossibleUrls(String filename) { + List<URL> urls = new ArrayList(5); try { - document = builder.parse(uri); + urls.add(new File(filename).toURL()); + urls.add(new File("conf/"+filename).toURL()); + } catch (MalformedURLException e) { + System.out.println("bad file url "+e); } - catch (FileNotFoundException e) { - return null; - } - return document; + urls.add(Config.class.getResource(filename)); + urls.add(Config.class.getResource("/"+filename)); + return urls; } - // do this with xml beans & xsd of config? - private void parseXmlFile(String filename) { - Document document=null; - try { - document = getDocument(filename); - } catch (Exception e) { - System.out.println("Xml config parse error: "+e); - e.printStackTrace(); - return; + private boolean urlExists(URL u) { + try { u.openStream(); } + catch (IOException e) { return false; } + //System.out.println("url suceeded "+u); + return true; + } + + // do some other way? DataAdapterManager has mapping? DataAdapter has mapping? + // DataAdapterManager.getAdapter(name)??? + private void addDataAdapterFromString(String daString) { + if (daString.equalsIgnoreCase("flybase")) + addDataAdapter(new FlybaseDataAdapter()); // for now... + else if (daString.equalsIgnoreCase("phenoxml")) + addDataAdapter(new PhenoXmlAdapter()); + } + + private void addDataAdapter(DataAdapterI da) { + if (dataAdapterList == null) + dataAdapterList = new ArrayList<DataAdapterI>(3); + dataAdapterList.add(da); + } + + private void makeFieldConfig(Field field) { + String name = field.getName().getStringValue(); + //String file = field.getFile().getStringValue(); + // has to be a valid value + CharFieldEnum cfe = CharFieldEnum.getCharFieldEnum(name); + //if (cfe == null) ??? + FieldConfig fc = new FieldConfig(cfe,name); + // if only one ontology file is an attribute... (convenience) + if (field.getFile() != null) { + String file = field.getFile().getStringValue(); + fc.addOntologyConfig(makeOntologyConfig(name,file)); } - Element root = document.getDocumentElement(); - NodeList kids = root.getChildNodes(); - int size = kids.getLength(); - for (int i=0; i<size; i++) { - Node node = kids.item(i); - parsePato(node); // if not pato does nothing - parseEntity(node); - parseGeneticContext(node); - parseDataAdapter(node); + // otherwise its multiple ontologies listed in ontology elements (entity) + else { + Ontology[] ontologies = field.getOntologyArray(); + for (Ontology o : ontologies) { + String oName = o.getName().getStringValue(); + String oFile = o.getFile().getStringValue(); + OntologyConfig oc = makeOntologyConfig(oName,oFile); + fc.addOntologyConfig(oc); + } } + fieldList.add(fc); } + + + private OntologyConfig makeOntologyConfig(String name, String file) { + OntologyConfig oc = new OntologyConfig(name,file); + return oc; + } + +} + +// OLD OLD OLD - DELETE - DOM STUFF - replaced with xml beans + +// /** Throws ParserConfig,SAXEx, & IOException if problems - sep class? */ +// private Document getDocument(String filename) throws Exception { +// DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); +// DocumentBuilder builder = dbf.newDocumentBuilder(); +// Document document = tryFile(builder,filename); +// if (document == null) +// document = tryFile(builder,"conf/"+filename); +// if (document == null) { // try jar file +// URL url = Config.class.getResource(filename); +// // hmmmm - so ontology data adapter prepends "/" for jar file but above +// // doesnt (which seems to work for web start but not jboss) try with +// // prepended slash as well - what the heck +// // its true this works for jboss - above for webstart - very strange +// if (url == null) +// url = Config.class.getResource("/"+filename); +// if (url == null) +// System.out.println("failed to get file from jar with or without '/' prepend"); +// else +// document = tryFile(builder,url.toString()); +// } + +// if (document == null) { +// System.out.println("Failed to find config file "+filename); +// throw new FileNotFoundException(filename); +// } +// return document; +// } + +// /** Returns null if cant find file, throws exception if parse fails */ +// private Document tryFile(DocumentBuilder builder, String uri) throws Exception { +// if (uri == null) return null; +// Document document = null; +// try { +// document = builder.parse(uri); +// } +// catch (FileNotFoundException e) { +// return null; +// } +// return document; +// } + +// // do this with xml beans & xsd of config? +// private void parseXmlFileWithDom(String filename) { +// Document document=null; +// try { +// document = getDocument(filename); +// } catch (Exception e) { +// System.out.println("Xml config parse error: "+e); +// e.printStackTrace(); +// return; +// } +// Element root = document.getDocumentElement(); +// NodeList kids = root.getChildNodes(); +// int size = kids.getLength(); +// for (int i=0; i<size; i++) { +// Node node = kids.item(i); +// parsePato(node); // if not pato does nothing +// parseEntity(node); +// parseGeneticContext(node); +// parseDataAdapter(node); +// } +// } + // private void parseLump(Node node) ... // return true if sucessfully parsed? - private void parsePato(Node node) { - if (!node.getNodeName().equals("pato")) return; - OntologyConfig oc = makeOntologyConfig(node,"Pato"); - //getPatoConfig().addOntologyConfig(oc); - patoConfig = new FieldConfig(CharFieldEnum.PATO,oc); - } +// private void parsePato(Node node) { +// if (!node.getNodeName().equals("pato")) return; +// OntologyConfig oc = makeOntologyConfig(node,"Pato"); +// //getPatoConfig().addOntologyConfig(oc); +// patoConfig = new FieldConfig(CharFieldEnum.PATO,oc); +// } - private void parseEntity(Node node) { - if (!node.getNodeName().equals("entity")) return; +// private void parseEntity(Node node) { +// if (!node.getNodeName().equals("entity")) return; - // while (hasMoreOntologies(node) ??? na! +// // while (hasMoreOntologies(node) ??? na! - // List <OntologyConfig> getOntologyConfigs(node) {} +// // List <OntologyConfig> getOntologyConfigs(node) {} - makeOntologyConfigs(node,getEntityConfig()); - //getEntityConfig().addOntologyConfig(oc); - //getEntityConfig().setOntologyConfigs(configs); - //entityConfigList.add(fc); - } +// makeOntologyConfigs(node,getEntityConfig()); +// //getEntityConfig().addOntologyConfig(oc); +// //getEntityConfig().setOntologyConfigs(configs); +// //entityConfigList.add(fc); +// } - private void parseGeneticContext(Node node) { - if (!node.getNodeName().equals("genetic-context")) return; - OntologyConfig oc = makeOntologyConfig(node,"Genetic Context"); - initGeneticContextConfig(oc); - // check if has ontology? - //getGeneticContextConfig().addOntologyConfig(oc); - } +// private void parseGeneticContext(Node node) { +// if (!node.getNodeName().equals("genetic-context")) return; +// OntologyConfig oc = makeOntologyConfig(node,"Genetic Context"); +// initGeneticContextConfig(oc); +// // check if has ontology? +// //getGeneticContextConfig().addOntologyConfig(oc); +// } - /** Return null if node doesnt actually have ontology info - like if there - is no file attribute which is required */ - private OntologyConfig makeOntologyConfig(Node node, String defaultName) { - String name = getNameAttribute(node); - if (name == null || name.equals("")) - name = defaultName; - // if field only has one ontology - if (!hasFileAttribute(node)) - return null; +// /** Return null if node doesnt actually have ontology info - like if there +// is no file attribute which is required */ +// private OntologyConfig makeOntologyConfig(Node node, String defaultName) { +// String name = getNameAttribute(node); +// if (name == null || name.equals("")) +// name = defaultName; +// // if field only has one ontology +// if (!hasFileAttribute(node)) +// return null; - String file = getFileAttribute(node); +// String file = getFileAttribute(node); - OntologyConfig oc = new OntologyConfig(name,file); - return oc; - } +// return makeOntologyConfig(name,file); +// } - /** so this is funny but the field node may contain info on a single ontology - or it may contain ontology kid nodes, in the case it has multiple ontolgies - like entity */ - private void makeOntologyConfigs(Node fieldNode, FieldConfig fieldConfig) { - String name = getNameAttribute(fieldNode); - if (name == null || name.equals("")) - name = fieldConfig.getLabel(); +// /** so this is funny but the field node may contain info on a single ontology +// or it may contain ontology kid nodes, in the case it has multiple ontolgies +// like entity */ +// private void makeOntologyConfigs(Node fieldNode, FieldConfig fieldConfig) { +// String name = getNameAttribute(fieldNode); +// if (name == null || name.equals("")) +// name = fieldConfig.getLabel(); - // if field only has one ontology will be specified in node attribs - OntologyConfig oc = makeOntologyConfig(fieldNode,name); - if (oc != null) - fieldConfig.addOntologyConfig(oc); // return? +// // if field only has one ontology will be specified in node attribs +// OntologyConfig oc = makeOntologyConfig(fieldNode,name); +// if (oc != null) +// fieldConfig.addOntologyConfig(oc); // return? - // see if theres mutliple ontologies specified as ontology elements - NodeList kids = fieldNode.getChildNodes(); - for (int i=0; i<kids.getLength(); i++) { - Node node = kids.item(i); - if (node.getNodeName().equals("ontology")) { - oc = makeOntologyConfig(node,name); - fieldConfig.addOntologyConfig(oc); - } - } - } +// // see if theres mutliple ontologies specified as ontology elements +// NodeList kids = fieldNode.getChildNodes(); +// for (int i=0; i<kids.getLength(); i++) { +// Node node = kids.item(i); +// if (node.getNodeName().equals("ontology")) { +// oc = makeOntologyConfig(node,name); +// fieldConfig.addOntologyConfig(oc); +// } +// } +// } - private boolean hasFileAttribute(Node node) { - return hasContent(getFileAttribute(node)); - } +// private boolean hasFileAttribute(Node node) { +// return hasContent(getFileAttribute(node)); +// } - private boolean hasContent(String s) { - return s != null && !s.equals(""); - } +// private boolean hasContent(String s) { +// return s != null && !s.equals(""); +// } - private String getFileAttribute(Node node) { - return getAttribute(node,"file"); - } +// private String getFileAttribute(Node node) { +// return getAttribute(node,"file"); +// } - private String getNameAttribute(Node node) { - return getAttribute(node,"name"); - } +// private String getNameAttribute(Node node) { +// return getAttribute(node,"name"); +// } - /** Returns null if node is not element, or attrib not attribute */ - private String getAttribute(Node node, String attrib) { - Element element = elementCast(node); - if (element == null) return null; - return element.getAttribute(attrib); - } +// /** Returns null if node is not element, or attrib not attribute */ +// private String getAttribute(Node node, String attrib) { +// Element element = elementCast(node); +// if (element == null) return null; +// return element.getAttribute(attrib); +// } - private Element elementCast(Node node) { - if (node instanceof Element) - return (Element)node; - System.out.println("Config xml parsing error, expected element " - +node.getNodeName()); - return null; // throw exception? - } +// private Element elementCast(Node node) { +// if (node instanceof Element) +// return (Element)node; +// System.out.println("Config xml parsing error, expected element " +// +node.getNodeName()); +// return null; // throw exception? +// } - private void parseDataAdapter(Node node) { - if (!node.getNodeName().equals("data-adapter")) return; - String name = getNameAttribute(node); - // do some other way? DataAdapterManager has mapping? DataAdapter has mapping? - // DataAdapterManager.getAdapter(name)??? - if (name.equalsIgnoreCase("flybase")) - addDataAdapter(new FlybaseDataAdapter()); // for now... - else if (name.equalsIgnoreCase("phenoxml")) - addDataAdapter(new PhenoXmlAdapter()); - } +// private void parseDataAdapter(Node node) { +// if (!node.getNodeName().equals("data-adapter")) return; +// String name = getNameAttribute(node); +// addDataAdapterFromString(name); +// } - private void addDataAdapter(DataAdapterI da) { - if (dataAdapterList == null) - dataAdapterList = new ArrayList<DataAdapterI>(3); - dataAdapterList.add(da); - } -} +//} Modified: phenote/trunk/src/java/phenote/dataadapter/fly/FlyCharacter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/fly/FlyCharacter.java 2006-08-21 15:49:04 UTC (rev 92) +++ phenote/trunk/src/java/phenote/dataadapter/fly/FlyCharacter.java 2006-08-22 18:19:35 UTC (rev 93) @@ -55,7 +55,7 @@ if (key.equals(ENTITY)) character.setEntity(oboClass); else if (key.equals(VALUE)) - character.setPato(oboClass); + character.setQuality(oboClass); else if (key.equals(GENETIC_CONTEXT)) character.setGeneticContext(oboClass); } @@ -97,7 +97,7 @@ StringBuffer sb = new StringBuffer(); sb.append(ENTITY).append(" > ").append(termString(character.getEntity())); sb.append("|"); - sb.append(VALUE).append(" > ").append(termString(character.getPato())); + sb.append(VALUE).append(" > ").append(termString(character.getQuality())); if (character.hasGeneticContext()) { sb.append("|"); sb.append(GENETIC_CONTEXT).append(" > "); Modified: phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java 2006-08-21 15:49:04 UTC (rev 92) +++ phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java 2006-08-22 18:19:35 UTC (rev 93) @@ -108,13 +108,13 @@ System.out.println("Character "+chr+" has no entity"); } - if (chr.getPato() != null) { + if (chr.getQuality() != null) { Quality q = pc.addNewQuality(); Typeref trq = q.addNewTyperef(); - trq.setAbout(chr.getPato().getID()); + trq.setAbout(chr.getQuality().getID()); } else { - System.out.println("Character "+chr+" has no quality(pato)"); + System.out.println("Character "+chr+" has no quality"); } } } Modified: phenote/trunk/src/java/phenote/datamodel/CharField.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharField.java 2006-08-21 15:49:04 UTC (rev 92) +++ phenote/trunk/src/java/phenote/datamodel/CharField.java 2006-08-22 18:19:35 UTC (rev 93) @@ -37,12 +37,12 @@ return new CharFieldValue(c.getEntity(),c,this); } }, - PATO("Pato") { + QUALITY("Quality") { public void setValue(CharacterI c, CharFieldValue v) { - c.setPato(v.getOboClass()); + c.setQuality(v.getOboClass()); } public CharFieldValue getValue(CharacterI c) { - return new CharFieldValue(c.getPato(),c,this); + return new CharFieldValue(c.getQuality(),c,this); } }; @@ -52,20 +52,22 @@ public abstract void setValue(CharacterI c, CharFieldValue v); public abstract CharFieldValue getValue(CharacterI c); - // uncler if we need this??? -// public CharFieldEnum getCharFieldEnum(String fieldString) { -// for ( CharFieldEnum cfe : CharFieldEnum.values()) { -// if (cfe.name.equalsIgnoreCase(fieldString)) -// return cfe; -// } -// System.out.println("ERROR: No Char Field found for string "+fieldString); -// return null; -// } // is this getting silly? abstract? --> char field value i think //public void setOboClass(CharacterI c, OBOClass o) {} //public OBOClass getOBOClass(CharacterI c) { return null; } + + // unclear if we need this??? need it in generic field config + public static CharFieldEnum getCharFieldEnum(String fieldString) { + for ( CharFieldEnum cfe : CharFieldEnum.values()) { + if (cfe.name.equalsIgnoreCase(fieldString)) + return cfe; + } + System.out.println("ERROR: No Char Field found for string "+fieldString); + return null; + } }; + private List<Ontology> ontologyList = new ArrayList<Ontology>(3); private CharFieldEnum charFieldEnum; // or subclass private String name; Modified: phenote/trunk/src/java/phenote/datamodel/Character.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/Character.java 2006-08-21 15:49:04 UTC (rev 92) +++ phenote/trunk/src/java/phenote/datamodel/Character.java 2006-08-22 18:19:35 UTC (rev 93) @@ -7,17 +7,17 @@ public class Character implements CharacterI, Cloneable { // private String entity=""; -// private String pato=""; +// private String quality=""; // private String geneticContext=""; private String genotype=""; // eventually Genotype class // OboClass? OntologyTerm?... private OBOClass entity; // CharFieldValue? - private OBOClass pato; + private OBOClass quality; private OBOClass geneticContext; public String getGenotype() { return genotype; } public OBOClass getEntity() { return entity; } - public OBOClass getPato() { return pato; } + public OBOClass getQuality() { return quality; } public boolean hasGeneticContext() { return geneticContext!=null && !geneticContext.equals(""); } @@ -25,18 +25,18 @@ // convenience functions public String getEntityName() { return entity.getName(); } - public String getPatoName() { return pato.getName(); } + public String getQualityName() { return quality.getName(); } public String getGeneticContextName() { return geneticContext.getName(); } public void setGenotype(String gt) { genotype = gt; } public void setEntity(OBOClass e) { entity = e; } - public void setPato(OBOClass p) { pato = p; } + public void setQuality(OBOClass p) { quality = p; } public void setGeneticContext(OBOClass gc) { geneticContext = gc; } public boolean equals(CharacterI ch) { return eq(genotype,ch.getGenotype()) && eq(entity,ch.getEntity()) - && eq(pato,ch.getPato()) && eq(geneticContext,ch.getGeneticContext()); + && eq(quality,ch.getQuality()) && eq(geneticContext,ch.getGeneticContext()); } /** check if both are null in addition to .equals() */ Modified: phenote/trunk/src/java/phenote/datamodel/CharacterI.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharacterI.java 2006-08-21 15:49:04 UTC (rev 92) +++ phenote/trunk/src/java/phenote/datamodel/CharacterI.java 2006-08-22 18:19:35 UTC (rev 93) @@ -7,19 +7,19 @@ public interface CharacterI { public String getEntityName(); - public String getPatoName(); // OBOClass? + public String getQualityName(); // OBOClass? public String getGeneticContextName(); public String getGenotype(); public OBOClass getEntity(); - public OBOClass getPato(); // OBOClass? + public OBOClass getQuality(); // OBOClass? public boolean hasGeneticContext(); public OBOClass getGeneticContext(); /** eventually have Genotype object? probably */ public void setGenotype(String gt); public void setEntity(OBOClass e); - public void setPato(OBOClass p); + public void setQuality(OBOClass p); public void setGeneticContext(OBOClass gc); public CharacterI cloneCharacter(); Modified: phenote/trunk/src/java/phenote/gui/CharFieldGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharFieldGui.java 2006-08-21 15:49:04 UTC (rev 92) +++ phenote/trunk/src/java/phenote/gui/CharFieldGui.java 2006-08-22 18:19:35 UTC (rev 93) @@ -65,6 +65,13 @@ boolean isCombo() { return isCombo; } void setValueFromChar(CharacterI character) { + if (charField == null) return; + if (charField.getCharFieldEnum() == null) { + System.out.println("ERROR: Cant set value for field. Gui for character field has" + +" not been associated with a datamodel field. check field" + +" names in config "); + return; + } String v = charField.getCharFieldEnum().getValue(character).getName(); setText(v); } @@ -158,7 +165,6 @@ private class FieldCharSelectListener implements CharSelectionListener { public void characterSelected(CharSelectionEvent e) { - /// do something... setValueFromChar(e.getCharacter()); } } Modified: phenote/trunk/src/java/phenote/gui/Phenote.java =================================================================== --- phenote/trunk/src/java/phenote/gui/Phenote.java 2006-08-21 15:49:04 UTC (rev 92) +++ phenote/trunk/src/java/phenote/gui/Phenote.java 2006-08-22 18:19:35 UTC (rev 93) @@ -16,7 +16,7 @@ public class Phenote { - private static final String VERSION = "0.6"; + private static final String VERSION = "0.7 dev"; //private static final String DEFAULT_CONFIG_FILE = Config.DEFAULT_CONFIG_FILE; private CharacterTablePanel characterTablePanel; Modified: phenote/trunk/src/java/phenote/gui/TermPanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/TermPanel.java 2006-08-21 15:49:04 UTC (rev 92) +++ phenote/trunk/src/java/phenote/gui/TermPanel.java 2006-08-22 18:19:35 UTC (rev 93) @@ -25,7 +25,7 @@ import phenote.config.FieldConfig; /** - * TermPanel holds all the fileds for the terms - Genotype, Entity/Anatomy, PATO. + * TermPanel holds all the fileds for the terms - Genotype, Entity/Anatomy, QUALITY. * Can be populated by hand (Genotype), or selection of instance in completion list. rename FieldPanel or CharFieldPanel? also has SearchParamPanel. @@ -122,8 +122,8 @@ return null; } - AutoComboBox getPatoComboBox() { - return getComboBox(CharFieldEnum.PATO); + AutoComboBox getQualityComboBox() { + return getComboBox(CharFieldEnum.QUALITY); } boolean hasLumpComboBox() { //return lumpField.isCombo(); @@ -141,7 +141,7 @@ // void clear() { // lumpField.setText(""); // entityField.setText(""); -// patoField.setText(""); +// qualityField.setText(""); // } // phase out direct connection for event/listener - obo edit stuff? @@ -151,8 +151,8 @@ // private boolean isEntity(String ontology) { // return ontology.equals(ANATOMY); // || GO... // } -// private boolean isPato(String ontology) { -// return ontology.equals(PATO); +// private boolean isQuality(String ontology) { +// return ontology.equals(QUALITY); // } // // this should be made generic to use beyond just genotype? yes yes yes @@ -177,9 +177,9 @@ // } // // change -> mvc -// void setPatoTableColumn(String patoTerm) { +// void setQualityTableColumn(String qualityTerm) { // // characterTablePanel.setSelectedColumn(ontEnum,term)??? -// characterTablePanel.setSelectedPatoTerm(patoTerm); +// characterTablePanel.setSelectedQualityTerm(qualityTerm); // } // /** rename - this sets term in table not field - hardwires from ontology @@ -189,8 +189,8 @@ // private void setTableColumn(String ontology, String term) { // if (isEntity(ontology)) // setEntityTableColumn(term); -// else if (isPato(ontology)) -// setPatoTableColumn(term); +// else if (isQuality(ontology)) +// setQualityTableColumn(term); // else if (ontology.equals(TAXONOMY)) // characterTablePanel.setSelectedGenotype(term); // //... @@ -202,9 +202,9 @@ // } // // change -> mvc -// void setPatoTableColumn(String patoTerm) { +// void setQualityTableColumn(String qualityTerm) { // // characterTablePanel.setSelectedColumn(ontEnum,term)??? -// characterTablePanel.setSelectedPatoTerm(patoTerm); +// characterTablePanel.setSelectedQualityTerm(qualityTerm); // } // /** rename - this sets term in table not field - hardwires from ontology @@ -214,8 +214,8 @@ // private void setTableColumn(String ontology, String term) { // if (isEntity(ontology)) // setEntityTableColumn(term); -// else if (isPato(ontology)) -// setPatoTableColumn(term); +// else if (isQuality(ontology)) +// setQualityTableColumn(term); // else if (ontology.equals(TAXONOMY)) // characterTablePanel.setSelectedGenotype(term); // //... @@ -267,38 +267,38 @@ // return ontologyManager.getEntityOntology(); // } -// private Ontology getPatoOntology() { -// //return new Ontology("Pato","attribute_and_value.obo"); -// return ontologyManager.getPatoOntology(); +// private Ontology getQualityOntology() { +// //return new Ontology("Quality","attribute_and_value.obo"); +// return ontologyManager.getQualityOntology(); // } // lumpField.setText(instance.getGenotype()); // entityField.setText(instance.getEntity()); -// patoField.setText(instance.getPato()); ???????? +// qualityField.setText(instance.getQuality()); ???????? // addLumpField(fieldPanel); // addGeneticContextField(fieldPanel); // if configured... // entityField = new CharFieldGui(getAnatomyOntology(),fieldPanel); -// //patoField = new CharFieldGui(getPatoOntology(),fieldPanel); -// patoField = new CharFieldGui(,fieldPanel); +// //qualityField = new CharFieldGui(getQualityOntology(),fieldPanel); +// qualityField = new CharFieldGui(,fieldPanel); // for (FieldConfig fieldConfig : config.getFieldConfigList() ) // addField(fieldConfig,fieldPanel); but field configs dont have ontologies... // would then have to do something like ontMan.getOntology(fc.getFieldEnum) // for (FieldOntology fieldOntology : ontologyManager.getFieldOntologyList()) // addField(fieldOntology,fieldPanel); // final static String ANATOMY = "Anatomy"; -// final static String PATO = "Pato"; +// final static String QUALITY = "Quality"; // final static String TAXONOMY = "Taxonomy"; // private CharFieldGui lumpField; // private CharFieldGui entityField; -// private CharFieldGui patoField; +// private CharFieldGui qualityField; // private CharFieldGui geneticContextField; // private String getInput(String ontology) { // if (isEntity(ontology)) // return entityField.getText(); -// if (isPato(ontology)) -// return patoField.getText(); +// if (isQuality(ontology)) +// return qualityField.getText(); // return ""; // error? // } // take out editable - always editable @@ -367,12 +367,12 @@ // searchPanel = sp; // // overlay?? home made jcombo - jcombo mac bug - list on top of jtext // // mac bug worked around thank goodness -// //searchPanel.setLocation(patoTextField.getLocation()); +// //searchPanel.setLocation(qualityTextField.getLocation()); // } //comboBox.setEditable(true); //ActionListener a = new AutoActionListener(ontologyString,comboBox); //comboBox.getEditor().addActionListener(a); //comboBox.addActionListener(a); //entityField.getDocument().addDocumentListener(new AutoDocumentListener(ANATOMY)); - //patoTextField = addField("Pato Term",this,true); - //patoTextField.getDocument().addDocumentListener(new AutoDocumentListener(PATO)); + //qualityTextField = addField("Quality Term",this,true); + //qualityTextField.getDocument().addDocumentListener(new AutoDocumentListener(QUALITY)); Modified: phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-21 15:49:04 UTC (rev 92) +++ phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-22 18:19:35 UTC (rev 93) @@ -37,6 +37,8 @@ String[] args = {"-c","initial-zfin.cfg"}; phenote.initConfig(args); // hardwire for now to zfin phenote.initOntologies(); + OntologyFileCheckThread ofct = new OntologyFileCheckThread(); + ofct.run(); } @@ -66,8 +68,7 @@ // "test</li>\n<li onmouseover=\"set_ontology()\" id=\"termId\" onclick=\"set_ontology()\">dude</li></ul>"; String ontol = getOntologyParamString(request); String list = getCompletionList(userInput,ontol); - int sz = (list.length() <= 85) ? list.length() : 85; - System.out.println("printing to response writer: "+list.substring(0,sz)+"..."); + System.out.println("printing to response writer: "+substring(list,55)+"..."); out.println(list); } @@ -118,11 +119,16 @@ System.out.println("term info: no obo class found for "+termId); return; } - System.out.println("term info "+HtmlUtil.termInfo(oboClass)); + System.out.println("term info "+substring(HtmlUtil.termInfo(oboClass),60)); out.println(HtmlUtil.termInfo(oboClass,ontologyName)); } } + private String substring(String s,int sz) { + sz = (s.length() <= sz) ? s.length() : sz; + return s.substring(0,sz); + } + private boolean isTermInfoRequest(HttpServletRequest req) { return getTermIdFromTermInfoRequest(req) != null; } @@ -151,16 +157,16 @@ /** returns null if ontolName not found */ private Ontology getOntology(String ontolName) { // termid?? or ontology name? - //return getPatoOntology(); + //return getQualityOntology(); return OntologyManager.getOntologyForName(ontolName); } // for now... - private Ontology getPatoOntology() { + private Ontology getQualityOntology() { for (CharField cf : OntologyManager.inst().getCharFieldList()) - if (cf.getCharFieldEnum() == CharFieldEnum.PATO) + if (cf.getCharFieldEnum() == CharFieldEnum.QUALITY) return cf.getFirstOntology(); - System.out.println("pato ontology not found in ontology manager"); + System.out.println("quality ontology not found in ontology manager"); return null; } @@ -185,6 +191,22 @@ } + /** thread wakes up and checks if theres a new ontology file - if so loads it + this should go in ontology data adapter... not here and configged */ + private class OntologyFileCheckThread extends Thread { + + public void run() { + + while(true) { + // check for files... + + + // sleep in milliseconds - sleep for 5 seconds for now (test) + //sleep(5000); + } + } + } + } Modified: phenote/trunk/src/java/test/phenote/gui/TestPhenote.java =================================================================== --- phenote/trunk/src/java/test/phenote/gui/TestPhenote.java 2006-08-21 15:49:04 UTC (rev 92) +++ phenote/trunk/src/java/test/phenote/gui/TestPhenote.java 2006-08-22 18:19:35 UTC (rev 93) @@ -36,7 +36,7 @@ private static TermPanel termPanel; private static SearchParamPanel searchParamPanel; private static AutoComboBox entityComboBox; - private static AutoComboBox patoComboBox; + private static AutoComboBox qualityComboBox; private static TermInfo termInfo; private static CharacterTablePanel characterTablePanel; @@ -55,8 +55,8 @@ searchParamPanel = termPanel.getSearchParamPanel(); entityComboBox = termPanel.getEntityComboBox(); entityComboBox.setTestMode(true); // turns off popup, hanging bug only in test - patoComboBox = termPanel.getPatoComboBox(); - patoComboBox.setTestMode(true); + qualityComboBox = termPanel.getQualityComboBox(); + qualityComboBox.setTestMode(true); termInfo = phenote.getTermInfo(); characterTablePanel = phenote.getCharacterTablePanel(); } @@ -69,9 +69,9 @@ comboTermSelectionGoesToTableTest(); synonymDupTest(); termInfoSelectTermTest(); - //attributeInPatoCompletionTest(); --> need 3 keystrokes 'ttr' + //attributeInQualityCompletionTest(); --> need 3 keystrokes 'ttr' //backspaceInComboBoxTest(); cant sim backspace..... - flyDataAdapterTest(); + //flyDataAdapterTest(); out of date its now doing phenoxml - soon will be syntax } private void displayTermInfoOnCompMouseOverTest() { @@ -81,15 +81,15 @@ System.out.println("set entity text to hea"); //entityComboBox.setText("hea",doCompletion); // already have list from l from previous test - for some reason 2nd l doesnt jibe - // even though there are lots of pato terms with 'll' ??? - //patoComboBox.simulateLKeyStroke(); // just does 'l' + // even though there are lots of quality terms with 'll' ??? + //qualityComboBox.simulateLKeyStroke(); // just does 'l' System.out.println("set text - getting 3rd term"); //JList entityJList = entityComboBox.getJList(); // pick 3rd item //String thirdTerm = (String)entityJList.getModel().getElementAt(2); //String thirdTerm = getEntityThirdAutoTerm(); - String thirdTerm = getPatoThirdAutoTerm(); - assertNotNull("3rd term from pato combo shouldnt be null",thirdTerm); + String thirdTerm = getQualityThirdAutoTerm(); + assertNotNull("3rd term from quality combo shouldnt be null",thirdTerm); //entityJList.setSelectedIndex(2); entityComboBox.doMouseOver(2); // 2 is 3rd - 0 indexing @@ -109,18 +109,18 @@ return entityComboBox.getModel().getElementAt(2).toString(); } - private String getPatoThirdAutoTerm() { - assertNotNull(patoComboBox.getModel()); - assertNotNull("3rd term from pato combo shouldnt be null", - patoComboBox.getModel().getElementAt(2)); - return patoComboBox.getModel().getElementAt(2).toString(); + private String getQualityThirdAutoTerm() { + assertNotNull(qualityComboBox.getModel()); + assertNotNull("3rd term from quality combo shouldnt be null", + qualityComboBox.getModel().getElementAt(2)); + return qualityComboBox.getModel().getElementAt(2).toString(); } - private String getPatoTerm(int index) { - assertNotNull(patoComboBox.getModel()); - assertNotNull(index+" term from pato combo shouldnt be null", - patoComboBox.getModel().getElementAt(index)); - return patoComboBox.getModel().getElementAt(index).toString(); + private String getQualityTerm(int index) { + assertNotNull(qualityComboBox.getModel()); + assertNotNull(index+" term from quality combo shouldnt be null", + qualityComboBox.getModel().getElementAt(index)); + return qualityComboBox.getModel().getElementAt(index).toString(); } /** Selecting item in entity combo box should cause that item to appear in @@ -128,25 +128,25 @@ private void comboTermSelectionGoesToTableTest() { // selecting item should make it go in table... System.out.println("Selecting 3rd entity item"); - patoComboBox.setSelectedIndex(2); // 2 is 3rd - String selectedPatoTerm = getPatoThirdAutoTerm(); + qualityComboBox.setSelectedIndex(2); // 2 is 3rd + String selectedQualityTerm = getQualityThirdAutoTerm(); CharacterI selPheno = characterTablePanel.getSelectedCharacter(); - String tablePato = selPheno.getPato().getName(); // oboclass - assertEquals(selectedPatoTerm,tablePato); - System.out.println("term to table test passed, selected pato term " - +selectedPatoTerm+" pato in table "+tablePato+"\n"); + String tableQuality = selPheno.getQuality().getName(); // oboclass + assertEquals(selectedQualityTerm,tableQuality); + System.out.println("term to table test passed, selected quality term " + +selectedQualityTerm+" quality in table "+tableQuality+"\n"); } - /** Test that attributes are being filtered out of pato term completion list */ - private void attributeInPatoCompletionTest() { + /** Test that attributes are being filtered out of quality term completion list */ + private void attributeInQualityCompletionTest() { boolean doCompletion = true; - System.out.println("Testing pato for attribute filtering"); + System.out.println("Testing quality for attribute filtering"); // need to do this with key strokes now - set text doesnt work // need at least 3 key strokes 'ttr' for attributes - i seem to have problems // getting more than one key stroke in - hmmmmm - patoComboBox.setText("attribute",doCompletion); - int count = patoComboBox.getItemCount(); - String m = "Attributes are not being filtered out of Pato completion "+ + qualityComboBox.setText("attribute",doCompletion); + int count = qualityComboBox.getItemCount(); + String m = "Attributes are not being filtered out of Quality completion "+ "There are "+count+" terms with 'attribute'"; System.out.println("There are "+count+" attributes in comp list"); assertTrue(m,count == 0); @@ -155,32 +155,32 @@ // cant get null pointer to fly - gotta love testing guis /** theres a null pointer on selcting item for 1st time, not sure i can replicate*/ private void compListSelectionTest() { - //patoComboBox.setText("larg",true); - patoComboBox.simulateLKeyStroke(); - patoComboBox.setSelectedIndex(2); - // this is admittedly presumptious of pato - assertEquals("AbnormalValue",patoComboBox.getText()); - System.out.println("comp list sel ok "+patoComboBox.getText()); + //qualityComboBox.setText("larg",true); + qualityComboBox.simulateLKeyStroke(); + qualityComboBox.setSelectedIndex(2); + // this is admittedly presumptious of quality + assertEquals("acute angle",qualityComboBox.getText()); + System.out.println("comp list sel ok "+qualityComboBox.getText()); } /** After term selected in comp list popup should not come up - this doesnt actually test this - the popup does go away with setSelInd - only with mouse click it sometimes doesnt - need simulated mouse click! */ private void selectionPopupTest() { - patoComboBox.setText("larg",true); - patoComboBox.setSelectedIndex(2); - assertFalse(patoComboBox.isPopupVisible()); + qualityComboBox.setText("larg",true); + qualityComboBox.setSelectedIndex(2); + assertFalse(qualityComboBox.isPopupVisible()); } /** with searching on synonyms hit bug where terms come in more than once if have 2 syns */ private void synonymDupTest() { - patoComboBox.setText(""); + qualityComboBox.setText(""); searchParamPanel.setTermSearch(false); searchParamPanel.setSynonymSearch(true); - simulateAPatoKeyStroke(); - String first = getPatoTerm(0); - String second = getPatoTerm(1); + simulateAQualityKeyStroke(); + String first = getQualityTerm(0); + String second = getQualityTerm(1); assertFalse(first.equals(second)); } @@ -189,7 +189,8 @@ simulatePhenoteHyperlinkUpdate(); String m = "term info hyper link test fail, term info should have body tone val " +" term info: "+termInfo.getText(); - assertTrue(m,termInfo.getText().contains("BodyToneValue")); + // how to make this test not so pato specific?? + assertTrue(m,termInfo.getText().contains("body tone value")); } private void simulatePhenoteHyperlinkUpdate() { @@ -200,12 +201,12 @@ termInfo.simulateHyperlinkEvent(e); } - private void simulateAPatoKeyStroke() { - simulatePatoKeyStroke(KeyEvent.VK_A,'a'); + private void simulateAQualityKeyStroke() { + simulateQualityKeyStroke(KeyEvent.VK_A,'a'); } - private void simulatePatoKeyStroke(int keyCode, char c) { - patoComboBox.simulateKeyStroke(keyCode,c); + private void simulateQualityKeyStroke(int keyCode, char c) { + qualityComboBox.simulateKeyStroke(keyCode,c); } private void flyDataAdapterTest() { @@ -264,17 +265,17 @@ // completion list */ // private void backspaceInComboBoxTest() { // boolean doCompletion = true; -// patoComboBox.clear(); -// patoComboBox.setText("larg",doCompletion); -// int preBackspaceCount = patoComboBox.getItemCount(); +// qualityComboBox.clear(); +// qualityComboBox.setText("larg",doCompletion); +// int preBackspaceCount = qualityComboBox.getItemCount(); // // simulate backspace/delete key -// KeyEvent ke = new KeyEvent(patoComboBox,KeyEvent.VK_DELETE,Calendar.getInstance().getTimeInMillis(),0,KeyEvent.VK_UNDEFINED,KeyEvent.CHAR_UNDEFINED); -// //patoComboBox.processKeyEvent(ke); -// patoComboBox.getEditor().getEditorComponent().processKeyEvent(ke); +// KeyEvent ke = new KeyEvent(qualityComboBox,KeyEvent.VK_DELETE,Calendar.getInstance().getTimeInMillis(),0,KeyEvent.VK_UNDEFINED,KeyEvent.CHAR_UNDEFINED); +// //qualityComboBox.processKeyEvent(ke); +// qualityComboBox.getEditor().getEditorComponent().processKeyEvent(ke); -// String postDelText = patoComboBox.getText(); -// int postBackspaceCount = patoComboBox.getItemCount(); +// String postDelText = qualityComboBox.getText(); +// int postBackspaceCount = qualityComboBox.getItemCount(); // System.out.println("post text "+postDelText+" pre count "+preBackspaceCount+" post count "+postBackspaceCount); // assertTrue(preBackspaceCount != postBackspaceCount); // } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-21 15:49:09
|
Revision: 92 Author: mgibson Date: 2006-08-21 08:49:04 -0700 (Mon, 21 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=92&view=rev Log Message: ----------- made phenotexmlbeans without all the other classes in them - woops Modified Paths: -------------- phenote/trunk/jars/phenoxmlbeans.jar Modified: phenote/trunk/jars/phenoxmlbeans.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-15 20:35:22
|
Revision: 91 Author: mgibson Date: 2006-08-15 13:35:14 -0700 (Tue, 15 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=91&view=rev Log Message: ----------- got entity ontology chooser working for webby phenote! Modified Paths: -------------- phenote/trunk/build.xml phenote/trunk/conf/initial-zfin.cfg phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java phenote/trunk/src/web/html/ncbo.html Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2006-08-14 13:16:51 UTC (rev 90) +++ phenote/trunk/build.xml 2006-08-15 20:35:14 UTC (rev 91) @@ -47,17 +47,19 @@ <exclude name="META-INF"/> </fileset> </path> + <path id="project.classpath3"> <fileset dir="${lib}"> <patternset id="non-phenote-jars"> <include name="**/*.jar"/> <exclude name="**/phenote.jar"/> + <exclude name="test/**"/> </patternset> </fileset> </path> <!-- The compile target runs javac on all the java files, and saves - them into the classfiles directory. --> + them into the classfiles directory. excludes="test/**" --> <target name="compile" depends="init"> <javac srcdir="${src}" destdir="${classfiles}" debug="yes" excludes="test/**"> <classpath refid="project.classpath3"/> @@ -67,7 +69,7 @@ <!-- runs off classfiles not jar, todo: run-jar --> <target name="run" depends="compile"> - <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx200M"> + <java classname="phenote.gui.Phenote" fork="yes" jvmargs="-Xmx120M"> <!-- arg value="-c configfilehereventually"/ --> <classpath> <pathelement path="${classfiles}"/> @@ -194,7 +196,7 @@ </target> <target name="compile-servlet"> - <javac srcdir="${src}" destdir="${web-classfiles}" debug="yes"> + <javac srcdir="${src}" destdir="${web-classfiles}" debug="yes" excludes="test/**"> <classpath refid="project.classpath3"/> </javac> </target> Modified: phenote/trunk/conf/initial-zfin.cfg =================================================================== --- phenote/trunk/conf/initial-zfin.cfg 2006-08-14 13:16:51 UTC (rev 90) +++ phenote/trunk/conf/initial-zfin.cfg 2006-08-15 20:35:14 UTC (rev 91) @@ -4,7 +4,10 @@ <genetic-context file="context.obo"/> - <entity name="Anatomy" file="zebrafish_anatomy.obo"/> + <entity name="Entity"> + <ontology name="Anatomy" file="zebrafish_anatomy.obo" /> + <ontology name="GO" file="gene_ontology.obo"/> + </entity> <pato file="quality.obo"/> Modified: phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-14 13:16:51 UTC (rev 90) +++ phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-15 20:35:14 UTC (rev 91) @@ -55,7 +55,7 @@ if (isTermCompletionRequest(request)) { String userInput = getTermCompletionParam(request); - System.out.println("ontology? "+getOntologyParamString(request)+" param entityInput? "+request.getParameter("entityInput")); + System.out.println("ontology? "+getOntologyParamString(request)+" param entityInput? "+getTermCompletionParam(request)); //ResourceBundle r=ResourceBundle.getBundle("LocalStrings",request.getLocale()); //Content-Type: text/html; charset=ISO-8859-1 response.setContentType("text/html"); @@ -139,7 +139,7 @@ // for now just grab the pato ontology - eventuall redo for multiple/config Ontology ontology = getOntology(ontol); if (ontology == null) { - System.out.println("failed to get pato from ontology manager"); + System.out.println("failed to get "+ontol+" from ontology manager"); return "ontology retrieval failed"; } Vector<OBOClass> v = ontology.getSearchTerms(userInput,getSearchParams()); Modified: phenote/trunk/src/web/html/ncbo.html =================================================================== --- phenote/trunk/src/web/html/ncbo.html 2006-08-14 13:16:51 UTC (rev 90) +++ phenote/trunk/src/web/html/ncbo.html 2006-08-15 20:35:14 UTC (rev 91) @@ -23,13 +23,14 @@ <script type="text/javascript"> function setEntityOntology(selectedOntology) { if (selectedOntology == 'AO') { - ontologyName = 'ZFA'; + ontologyName = 'Anatomy'; <!-- ZFA --> } else if (selectedOntology == 'GO') { ontologyName = 'GO'; } - entityAutoCompleter.options.parameters = "ontologyName=" + ontologyName; - alert(entityAutoCompleter.options.parameters); +<!-- entityAutoCompleter.options.parameters = "ontologyName=" + ontologyName; --> + entityAutoCompleter.options.defaultParams = "ontologyName=" + ontologyName; + alert(entityAutoCompleter.options.defaultParams); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-14 13:17:00
|
Revision: 90 Author: mgibson Date: 2006-08-14 06:16:51 -0700 (Mon, 14 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=90&view=rev Log Message: ----------- changed build file for web deployment to use environment variable previously it was using directories which we're symobolic links also changed some indenting from kevins commit from 6 spaces to 2 env vars for web deploy to tomcat: setenv PHENOTE_WEB_CONF_FILES $TOMCAT_WEB_ROOT setenv PHENOTE_WEB_CLASSFILES "${TOMCAT_WEB_ROOT}/WEB-INF/classes" setenv PHENOTE_WEB_HTML "${TOMCAT_WEB_ROOT}/phenote/0.6/web-interface" well thats how i do it at least - you get the idea Modified Paths: -------------- phenote/trunk/build.xml phenote/trunk/conf/initial-zfin.cfg phenote/trunk/src/java/phenote/gui/Phenote.java phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java phenote/trunk/src/web/web.xml Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2006-08-09 22:18:09 UTC (rev 89) +++ phenote/trunk/build.xml 2006-08-14 13:16:51 UTC (rev 90) @@ -3,17 +3,24 @@ ant build file ====================================================================== --> +<!-- environment variable $PHENOTE_WEB_CONF_FILES need to be set to --> +<!-- where cfg & obo files go on the web deployment for web-deployment --> +<!-- to work, $PHENOTE_WEB_CLASSFILES for classfile deployment --> + <project name="phenote" default="compile" basedir="."> <description>phenote ant build</description> - + <!-- allows for use of environment vars --> + <property environment="env"/> <!-- property name="src-svn" value="./src/java" / --> <property name="src" value="./src/java" /> <property name="test" value="./src/java/test" /> <!-- where classes go --> <property name="classfiles" value="classfiles" /> <!-- symbolic link over to web world --> - <property name="web-classfiles" value="web-classfiles" /> + <property name="web-classfiles" value="${env.PHENOTE_WEB_CLASSFILES}" /> + <property name="web-conf" value="${env.PHENOTE_WEB_CONF_FILES}"/> + <property name="web-html" value="${env.PHENOTE_WEB_HTML}"/> <property name="lib" value="jars" /> <property name="jarfile" value="jars/phenote.jar"/> <property name="obo" value="obo-files" /> @@ -193,16 +200,16 @@ </target> <!-- web-deployment & web-config-files should be a symoblic link to ones web site --> - <target name="web-deployment"> - <copy todir="web-deployment"> + <target name="web-deployment" depends="compile-servlet"> + <copy todir="${web-html}"> <fileset dir="src/web"/> </copy> - <copy todir="${web-classfiles}"> + <copy todir="${web-conf}"> <fileset dir="conf"> <include name="*.cfg"/> </fileset> </copy> - <copy todir="${web-classfiles}"> + <copy todir="${web-conf}"> <fileset dir="obo-files" /> </copy> </target> Modified: phenote/trunk/conf/initial-zfin.cfg =================================================================== --- phenote/trunk/conf/initial-zfin.cfg 2006-08-09 22:18:09 UTC (rev 89) +++ phenote/trunk/conf/initial-zfin.cfg 2006-08-14 13:16:51 UTC (rev 90) @@ -1,4 +1,4 @@ -<phenote-configuration version="0.4"> +<phenote-configuration version="0.6"> <data-adapter name="phenoxml"/> Modified: phenote/trunk/src/java/phenote/gui/Phenote.java =================================================================== --- phenote/trunk/src/java/phenote/gui/Phenote.java 2006-08-09 22:18:09 UTC (rev 89) +++ phenote/trunk/src/java/phenote/gui/Phenote.java 2006-08-14 13:16:51 UTC (rev 90) @@ -16,7 +16,7 @@ public class Phenote { - private static final String VERSION = "0.6 dev"; + private static final String VERSION = "0.6"; //private static final String DEFAULT_CONFIG_FILE = Config.DEFAULT_CONFIG_FILE; private CharacterTablePanel characterTablePanel; Modified: phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-09 22:18:09 UTC (rev 89) +++ phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-14 13:16:51 UTC (rev 90) @@ -40,7 +40,8 @@ } - /** this should be done in java server faces/pages(?), post comes from ajax + /** AUTO COMPLETE REQUEST + this should be done in java server faces/pages(?), post comes from ajax autocompleter on typing in stuff */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { @@ -65,7 +66,7 @@ // "test</li>\n<li onmouseover=\"set_ontology()\" id=\"termId\" onclick=\"set_ontology()\">dude</li></ul>"; String ontol = getOntologyParamString(request); String list = getCompletionList(userInput,ontol); - int sz = (list.length() <= 85) ? list.length() : 85; + int sz = (list.length() <= 85) ? list.length() : 85; System.out.println("printing to response writer: "+list.substring(0,sz)+"..."); out.println(list); } @@ -78,9 +79,9 @@ /** this should be renamed from unintuitive "ontologyname" */ private String getTermCompletionParam(HttpServletRequest req) { - String par = req.getParameter("userInput"); // new way - if (par ==null) - par = req.getParameter("patoInput"); // for now + String par = req.getParameter("userInput"); // new way + if (par ==null) + par = req.getParameter("patoInput"); // for now if (par == null) par = req.getParameter("entityInput"); return par; @@ -92,7 +93,8 @@ - /** i cant tell ya why but term info is done with a get and term completion + /** TERM INFO request + i cant tell ya why but term info is done with a get and term completion is done with a post - is there rhyme or reason to this? */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { Modified: phenote/trunk/src/web/web.xml =================================================================== --- phenote/trunk/src/web/web.xml 2006-08-09 22:18:09 UTC (rev 89) +++ phenote/trunk/src/web/web.xml 2006-08-14 13:16:51 UTC (rev 90) @@ -12,6 +12,7 @@ <servlet-mapping> <servlet-name>Phenote</servlet-name> - <url-pattern>/Phenote</url-pattern> + <!-- url-pattern>/Phenote</url-pattern --> + <url-pattern>/phenote/Phenote</url-pattern> </servlet-mapping> </web-app> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-09 22:59:57
|
Revision: 87 Author: mgibson Date: 2006-08-09 15:08:16 -0700 (Wed, 09 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=87&view=rev Log Message: ----------- release 0.6 a little late but good enough Added Paths: ----------- phenote/tags/release-0.6/ Copied: phenote/tags/release-0.6 (from rev 86, phenote/trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-09 22:18:12
|
Revision: 89 Author: mgibson Date: 2006-08-09 15:18:09 -0700 (Wed, 09 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=89&view=rev Log Message: ----------- took out windows ctrl-M line returns Modified Paths: -------------- phenote/trunk/src/web/html/ncbo.html Modified: phenote/trunk/src/web/html/ncbo.html =================================================================== --- phenote/trunk/src/web/html/ncbo.html 2006-08-09 22:12:02 UTC (rev 88) +++ phenote/trunk/src/web/html/ncbo.html 2006-08-09 22:18:09 UTC (rev 89) @@ -1,150 +1,150 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> -<HTML> -<HEAD> - -<TITLE> Phenote </TITLE> - -<!-- we need some way of parameterizing the root of the web files??? --> -<!-- set in some file somewhere? --> - -<link href="../css/control.css" type="text/css" rel="stylesheet"> - -<!-- Ajax stuff (prototype library and friends)--> - -<script src="../javascript/ajax-lib/prototype.js" type="text/javascript"></script> -<script src="../javascript/ajax-lib/effects.js" type="text/javascript"></script> -<script src="../javascript/ajax-lib/dragdrop.js" type="text/javascript"></script> -<script src="../javascript/ajax-lib/controls.js" type="text/javascript"></script> -<!-- /Ajax stuff --> - -<!-- /Custom Javascript --> - -<script src="../javascript/ncbo-term-info.js" type="text/javascript"></script> -<script type="text/javascript"> - function setEntityOntology(selectedOntology) { - if (selectedOntology == 'AO') { - ontologyName = 'ZFA'; - } else if (selectedOntology == 'GO') { - ontologyName = 'GO'; - } - - entityAutoCompleter.options.parameters = "ontologyName=" + ontologyName; - alert(entityAutoCompleter.options.parameters); - - } - -</script> - -</HEAD> -<BODY> - -<!-- table width="50%" --> - -<!-- tr height="20%" --> - -<!-- td width="20%" --> - -<form width="20%"> - <div id="ontology" width="20%"> - - <!-- table width="20%" --> - <!-- tr --> - <!-- td --> - - <!-- ENTITY --> - - <!-- div style="float: left;" --> - <div style="float: left;" width="20%"> - - <fieldset class="search"> - <br/><br/><br/> - - <label for="entityOntology">Ontology:</label> - <select name="entityOntology" id="entityOntology" onChange="setEntityOntology(this.options[this.selectedIndex].value);"> - <option value="AO">AO</option> - <option value="GO">GO</option> - </select> - - <label>Entity: </label> - - <!-- input autocomplete="off" id="ontologyname" name="ontologyname" size="20" type="text" value="" / --> - <input autocomplete="off" id="entityInput" name="entityInput" size="40" type="text" value="" /> - </br> - <div class="auto_complete" id="entity_auto_complete"></div> - </fieldset> - - </div> - - <!-- /td --> - <!-- /tr --> - <!-- tr -- --> - <!-- td --> - - <!-- PATO --> - - <div style="clear: left;"> - <!-- div width="20%" --> - - <fieldset class="search"> - <br/><br/><br/> - <label>Quality: </label> - - <!-- input autocomplete="off" id="ontologyname" name="ontologyname" size="20" type="text" value="" / --> - <input autocomplete="off" id="patoInput" name="patoInput" size="40" type="text" value="" /> - </br> - <div class="auto_complete" id="pato_auto_complete"></div> - </fieldset> - - </div> - - <!-- /td --> - <!-- /tr --> - <!-- /table --> - - - </div> - - - - <script type="text/javascript"> - <!-- this is the crucial javascript bit here, patoInput is the --> - <!-- input field, i pato_auto_complete is the div where--> - <!--the auto completion will pop up, and the last param is the--> - <!-- script that will does the fetching of terms --> - <!-- Autocomp is in js/prototype/controls.js --> - <!-- new Ajax.Autocompleter( 'ontologyname', --> - <!-- 'ontologyname_auto_complete', '/phenote-ontology.cgi',{ }) --> - <!-- new Ajax.Autocompleter( 'ontologyname', 'ontologyname_auto_complete', '/servlet/PhenoteStub',{ }) --> - <!-- new Ajax.Autocompleter( 'ontologyname', 'ontologyname_auto_complete', '/servlet/phenote.servlet.PhenoteServlet',{ }) --> - var complete = new Ajax.Autocompleter( 'patoInput', 'pato_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=pato',paramName: "userInput" }) - <!-- complete.options.defaultParams = "ontology=pato"; --> - <!-- complete.options.parameters = "ontology=pato"; --> - <!-- more params? 'ontology=pato&x=y&...' --> - </script> - - <script type="text/javascript"> - var entityAutoCompleter = new Ajax.Autocompleter( 'entityInput', 'entity_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=anatomy',paramName: "userInput"}) - </script> - - - - <!-- this is set by ncbo-term-info.js but its unclear what its for is this the datamodel???? --> - <input type="hidden" name="ontologyid"> -</form> - -<!-- /td --> - -<!-- td width="80%" --> - <div id="termInfo"></div> -<!-- /td --> - - - -<!-- /td --> -<!-- /tr --> -<!-- tr height="80%" --><!-- td --> <!-- /td --></tr --> -<!-- /table --> - -</body> -</html> - +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<HTML> +<HEAD> + +<TITLE> Phenote </TITLE> + +<!-- we need some way of parameterizing the root of the web files??? --> +<!-- set in some file somewhere? --> + +<link href="../css/control.css" type="text/css" rel="stylesheet"> + +<!-- Ajax stuff (prototype library and friends)--> + +<script src="../javascript/ajax-lib/prototype.js" type="text/javascript"></script> +<script src="../javascript/ajax-lib/effects.js" type="text/javascript"></script> +<script src="../javascript/ajax-lib/dragdrop.js" type="text/javascript"></script> +<script src="../javascript/ajax-lib/controls.js" type="text/javascript"></script> +<!-- /Ajax stuff --> + +<!-- /Custom Javascript --> + +<script src="../javascript/ncbo-term-info.js" type="text/javascript"></script> +<script type="text/javascript"> + function setEntityOntology(selectedOntology) { + if (selectedOntology == 'AO') { + ontologyName = 'ZFA'; + } else if (selectedOntology == 'GO') { + ontologyName = 'GO'; + } + + entityAutoCompleter.options.parameters = "ontologyName=" + ontologyName; + alert(entityAutoCompleter.options.parameters); + + } + +</script> + +</HEAD> +<BODY> + +<!-- table width="50%" --> + +<!-- tr height="20%" --> + +<!-- td width="20%" --> + +<form width="20%"> + <div id="ontology" width="20%"> + + <!-- table width="20%" --> + <!-- tr --> + <!-- td --> + + <!-- ENTITY --> + + <!-- div style="float: left;" --> + <div style="float: left;" width="20%"> + + <fieldset class="search"> + <br/><br/><br/> + + <label for="entityOntology">Ontology:</label> + <select name="entityOntology" id="entityOntology" onChange="setEntityOntology(this.options[this.selectedIndex].value);"> + <option value="AO">AO</option> + <option value="GO">GO</option> + </select> + + <label>Entity: </label> + + <!-- input autocomplete="off" id="ontologyname" name="ontologyname" size="20" type="text" value="" / --> + <input autocomplete="off" id="entityInput" name="entityInput" size="40" type="text" value="" /> + </br> + <div class="auto_complete" id="entity_auto_complete"></div> + </fieldset> + + </div> + + <!-- /td --> + <!-- /tr --> + <!-- tr -- --> + <!-- td --> + + <!-- PATO --> + + <div style="clear: left;"> + <!-- div width="20%" --> + + <fieldset class="search"> + <br/><br/><br/> + <label>Quality: </label> + + <!-- input autocomplete="off" id="ontologyname" name="ontologyname" size="20" type="text" value="" / --> + <input autocomplete="off" id="patoInput" name="patoInput" size="40" type="text" value="" /> + </br> + <div class="auto_complete" id="pato_auto_complete"></div> + </fieldset> + + </div> + + <!-- /td --> + <!-- /tr --> + <!-- /table --> + + + </div> + + + + <script type="text/javascript"> + <!-- this is the crucial javascript bit here, patoInput is the --> + <!-- input field, i pato_auto_complete is the div where--> + <!--the auto completion will pop up, and the last param is the--> + <!-- script that will does the fetching of terms --> + <!-- Autocomp is in js/prototype/controls.js --> + <!-- new Ajax.Autocompleter( 'ontologyname', --> + <!-- 'ontologyname_auto_complete', '/phenote-ontology.cgi',{ }) --> + <!-- new Ajax.Autocompleter( 'ontologyname', 'ontologyname_auto_complete', '/servlet/PhenoteStub',{ }) --> + <!-- new Ajax.Autocompleter( 'ontologyname', 'ontologyname_auto_complete', '/servlet/phenote.servlet.PhenoteServlet',{ }) --> + var complete = new Ajax.Autocompleter( 'patoInput', 'pato_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=pato',paramName: "userInput" }) + <!-- complete.options.defaultParams = "ontology=pato"; --> + <!-- complete.options.parameters = "ontology=pato"; --> + <!-- more params? 'ontology=pato&x=y&...' --> + </script> + + <script type="text/javascript"> + var entityAutoCompleter = new Ajax.Autocompleter( 'entityInput', 'entity_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=anatomy',paramName: "userInput"}) + </script> + + + + <!-- this is set by ncbo-term-info.js but its unclear what its for is this the datamodel???? --> + <input type="hidden" name="ontologyid"> +</form> + +<!-- /td --> + +<!-- td width="80%" --> + <div id="termInfo"></div> +<!-- /td --> + + + +<!-- /td --> +<!-- /tr --> +<!-- tr height="80%" --><!-- td --> <!-- /td --></tr --> +<!-- /table --> + +</body> +</html> + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-08-09 22:12:09
|
Revision: 88 Author: mgibson Date: 2006-08-09 15:12:02 -0700 (Wed, 09 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=88&view=rev Log Message: ----------- release 0.6 a little late but good enough Added Paths: ----------- phenote/tags/release-0.6/trunk/ Copied: phenote/tags/release-0.6/trunk (from rev 87, phenote/trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <so...@us...> - 2006-08-07 16:10:49
|
Revision: 86 Author: sohelm Date: 2006-08-07 09:10:45 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=86&view=rev Log Message: ----------- Added new css elements for the term completer Modified Paths: -------------- phenote/trunk/src/web/css/term_completer.css Modified: phenote/trunk/src/web/css/term_completer.css =================================================================== --- phenote/trunk/src/web/css/term_completer.css 2006-08-07 16:08:43 UTC (rev 85) +++ phenote/trunk/src/web/css/term_completer.css 2006-08-07 16:10:45 UTC (rev 86) @@ -6,20 +6,19 @@ border: 1px solid gray; padding: 2px 2px 2px 2px; float: left; - width: 630; + width: 800; } - div#terminfo { - float: left; + div#terminfo { width: 375; height: 100%; - float: left; + float: right; } /* div returned from ajax record retreival */ div#terminfo table { - border: 1px solid blue; + border: 1px solid gray; width: 100%; font-size: 14px; background-color: lightgoldenrodyellow; @@ -46,7 +45,7 @@ font-weight:bold; } fieldset.search { - width: 250; + width: 800; } @@ -75,3 +74,13 @@ margin:0; padding:0; } + + + +input { +border: 1px solid gray; +} + +TEXTAREA { +border: 1px solid gray; +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <so...@us...> - 2006-08-07 16:08:55
|
Revision: 85 Author: sohelm Date: 2006-08-07 09:08:43 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=85&view=rev Log Message: ----------- Made the term_completer.html modular. One could pass parameters to this html. Look at interface.html to see the usage. Modified Paths: -------------- phenote/trunk/src/web/html/interface.html phenote/trunk/src/web/html/term_completer.html Modified: phenote/trunk/src/web/html/interface.html =================================================================== --- phenote/trunk/src/web/html/interface.html 2006-08-05 00:20:09 UTC (rev 84) +++ phenote/trunk/src/web/html/interface.html 2006-08-07 16:08:43 UTC (rev 85) @@ -21,12 +21,54 @@ <div id="ontology"> <div style="float: left;"> +<link href="/web/css/term_completer.css" type="text/css" rel="stylesheet"> +<form> + <!-- term_completer.html code start --> +<table> +<tr> +<!--#set var="tag" value="genotype" --> +<!--#set var="title" value="Genotype" --> +<!--#set var="url" value="/db/cgi-bin/ajax_search/genotype.cgi" --> <!--#include virtual="term_completer.html" --> +</tr><tr> +<!--#set var="tag" value="mutant_type" --> +<!--#set var="title" value="Mutant Type" --> +<!--#set var="url" value="/db/cgi-bin/ajax_search/genotype.cgi" --> +<!--#include virtual="term_completer.html" --> +</tr><tr> +<!--#set var="tag" value="genetic_context" --> +<!--#set var="title" value="Genetic Context" --> +<!--#set var="url" value="/db/cgi-bin/ajax_search/genotype.cgi" --> +<!--#include virtual="term_completer.html" --> +</tr><tr> +<!--#set var="tag" value="entity" --> +<!--#set var="title" value="Entity" --> +<!--#set var="url" value="/db/cgi-bin/ajax_search/entity.cgi" --> +<!--#include virtual="term_completer.html" --> +</tr><tr> +<!--#set var="tag" value="quality" --> +<!--#set var="title" value="Quality" --> +<!--#set var="url" value="/db/cgi-bin/ajax_search/quality.cgi" --> +<!--#include virtual="term_completer.html" --> +</tr><tr> +<!--#set var="tag" value="reference" --> +<!--#set var="title" value="Reference" --> +<!--#set var="url" value="/db/cgi-bin/ajax_search/quality.cgi" --> +<!--#include virtual="term_completer.html" --> +</tr><tr> +<td> +<b>Notes</b> +</td> +<td> +<TEXTAREA NAME="notes" ROWS="4", COLS="20"> </TEXTAREA> +</td> +</tr> +</table> <!-- term_completer.html code ends --> +</form> </div> - <div id="terminfo"></div> </div> </td></tr> Modified: phenote/trunk/src/web/html/term_completer.html =================================================================== --- phenote/trunk/src/web/html/term_completer.html 2006-08-05 00:20:09 UTC (rev 84) +++ phenote/trunk/src/web/html/term_completer.html 2006-08-07 16:08:43 UTC (rev 85) @@ -1,22 +1,37 @@ -<link href="/web/css/term_completer.css" type="text/css" rel="stylesheet"> -<form> -<script src="/web/javascript/term_completer.js" type="text/javascript"></script> - <fieldset class="search"> - Search terms in PATO ontology<br/><br/><br/> - <label>Name:</label> - <input autocomplete="off" id="term" name="term" size="20" type="text" value="" /> - </br> - <div class="auto_complete" id="term_auto_complete"></div> - </fieldset> +<td> <b><!--#if expr="\"tag\"" --><!--#echo var="title" --><!--#endif --></b> +</td> +<td> +<input autocomplete="off" id="<!--#if expr="\"tag\"" --><!--#echo var="tag" --><!--#endif -->" name="<!--#if expr="\"tag\"" --><!--#echo var="tag" --><!--#endif -->" size="26" type="text" value="" /> +</td> +<BR><div class="auto_complete" id="<!--#if expr="\"tag\"" --><!--#echo var="tag" --><!--#endif -->_auto_complete"></div> +<input type="hidden" name="<!--#if expr="\"tag\"" --><!--#echo var="tag" --><!--#endif -->id"> + <script type="text/javascript"> - new Ajax.Autocompleter( 'term', 'term_auto_complete', url,{ }) + function set_<!--#if expr="\"tag\"" --><!--#echo var="tag" --><!--#endif -->_term(termid){ + if ( !isNaN( termid ) ) { + var pars = 'termid=' + termid; + + var myAjax = new Ajax.Updater('terminfo', "<!--#if expr="\"url\"" --><!--#echo var="url" --><!--#endif -->", {method: 'get', parameters: pars } ); + // have to have [1] next to form item because the edit subform and + // the main form both have donorid elements + if ( document.forms[0].termid.length > 1 ) { + document.forms[0].<!--#if expr="\"tag\"" --><!--#echo var="tag" --><!--#endif -->id[1].value = termid; + document.forms[0].<!--#if expr="\"tag\"" --><!--#echo var="tag" --><!--#endif -->id[2].value = termid; + } + else { + document.forms[0].<!--#if expr="\"tag\"" --><!--#echo var="tag" --><!--#endif -->id.value = termid; + } + } + + + } + + new Ajax.Autocompleter( '<!--#if expr="\"tag\"" --><!--#echo var="tag" --><!--#endif -->', '<!--#if expr="\"tag\"" --><!--#echo var="tag" --><!--#endif -->_auto_complete', '<!--#if expr="\"url\"" --><!--#echo var="url" --><!--#endif -->',{ }); </script> -<input type="hidden" name="termid"> -</form> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kev...@us...> - 2006-08-05 00:20:12
|
Revision: 84 Author: kevinschaper Date: 2006-08-04 17:20:09 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=84&view=rev Log Message: ----------- added entity ontology chooser - still putting out alert messages, but mostly doing what it needs to. Modified Paths: -------------- phenote/trunk/src/web/html/ncbo.html Modified: phenote/trunk/src/web/html/ncbo.html =================================================================== --- phenote/trunk/src/web/html/ncbo.html 2006-08-04 23:10:16 UTC (rev 83) +++ phenote/trunk/src/web/html/ncbo.html 2006-08-05 00:20:09 UTC (rev 84) @@ -20,8 +20,21 @@ <!-- /Custom Javascript --> <script src="../javascript/ncbo-term-info.js" type="text/javascript"></script> +<script type="text/javascript"> + function setEntityOntology(selectedOntology) { + if (selectedOntology == 'AO') { + ontologyName = 'ZFA'; + } else if (selectedOntology == 'GO') { + ontologyName = 'GO'; + } + entityAutoCompleter.options.parameters = "ontologyName=" + ontologyName; + alert(entityAutoCompleter.options.parameters); + } + +</script> + </HEAD> <BODY> @@ -45,6 +58,13 @@ <fieldset class="search"> <br/><br/><br/> + + <label for="entityOntology">Ontology:</label> + <select name="entityOntology" id="entityOntology" onChange="setEntityOntology(this.options[this.selectedIndex].value);"> + <option value="AO">AO</option> + <option value="GO">GO</option> + </select> + <label>Entity: </label> <!-- input autocomplete="off" id="ontologyname" name="ontologyname" size="20" type="text" value="" / --> @@ -103,7 +123,7 @@ </script> <script type="text/javascript"> - new Ajax.Autocompleter( 'entityInput', 'entity_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=anatomy',paramName: "userInput"}) + var entityAutoCompleter = new Ajax.Autocompleter( 'entityInput', 'entity_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=anatomy',paramName: "userInput"}) </script> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kev...@us...> - 2006-08-04 23:10:18
|
Revision: 83 Author: kevinschaper Date: 2006-08-04 16:10:16 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=83&view=rev Log Message: ----------- Made input elements larger (from 20 to 40), added 'userInput' setting to autocompleter call to match servlet change. The'userInput' param decouples the name of the input field being autocompleted from the servlet. Modified Paths: -------------- phenote/trunk/src/web/html/ncbo.html Modified: phenote/trunk/src/web/html/ncbo.html =================================================================== --- phenote/trunk/src/web/html/ncbo.html 2006-08-04 23:03:57 UTC (rev 82) +++ phenote/trunk/src/web/html/ncbo.html 2006-08-04 23:10:16 UTC (rev 83) @@ -1,130 +1,130 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> -<HTML> -<HEAD> - -<TITLE> Phenote </TITLE> - -<!-- we need some way of parameterizing the root of the web files??? --> -<!-- set in some file somewhere? --> - -<link href="../css/control.css" type="text/css" rel="stylesheet"> - -<!-- Ajax stuff (prototype library and friends)--> - -<script src="../javascript/ajax-lib/prototype.js" type="text/javascript"></script> -<script src="../javascript/ajax-lib/effects.js" type="text/javascript"></script> -<script src="../javascript/ajax-lib/dragdrop.js" type="text/javascript"></script> -<script src="../javascript/ajax-lib/controls.js" type="text/javascript"></script> -<!-- /Ajax stuff --> - -<!-- /Custom Javascript --> - -<script src="../javascript/ncbo-term-info.js" type="text/javascript"></script> - - -</HEAD> -<BODY> - -<!-- table width="50%" --> - -<!-- tr height="20%" --> - -<!-- td width="20%" --> - -<form width="20%"> - <div id="ontology" width="20%"> - - <!-- table width="20%" --> - <!-- tr --> - <!-- td --> - - <!-- ENTITY --> - - <!-- div style="float: left;" --> - <div style="float: left;" width="20%"> - - <fieldset class="search"> - <br/><br/><br/> - <label>Entity: </label> - - <!-- input autocomplete="off" id="ontologyname" name="ontologyname" size="20" type="text" value="" / --> - <input autocomplete="off" id="entityInput" name="entityInput" size="20" type="text" value="" /> - </br> - <div class="auto_complete" id="entity_auto_complete"></div> - </fieldset> - - </div> - - <!-- /td --> - <!-- /tr --> - <!-- tr -- --> - <!-- td --> - - <!-- PATO --> - - <div style="clear: left;"> - <!-- div width="20%" --> - - <fieldset class="search"> - <br/><br/><br/> - <label>Quality: </label> - - <!-- input autocomplete="off" id="ontologyname" name="ontologyname" size="20" type="text" value="" / --> - <input autocomplete="off" id="patoInput" name="patoInput" size="20" type="text" value="" /> - </br> - <div class="auto_complete" id="pato_auto_complete"></div> - </fieldset> - - </div> - - <!-- /td --> - <!-- /tr --> - <!-- /table --> - - - </div> - - - - <script type="text/javascript"> - <!-- this is the crucial javascript bit here, patoInput is the --> - <!-- input field, i pato_auto_complete is the div where--> - <!--the auto completion will pop up, and the last param is the--> - <!-- script that will does the fetching of terms --> - <!-- Autocomp is in js/prototype/controls.js --> - <!-- new Ajax.Autocompleter( 'ontologyname', --> - <!-- 'ontologyname_auto_complete', '/phenote-ontology.cgi',{ }) --> - <!-- new Ajax.Autocompleter( 'ontologyname', 'ontologyname_auto_complete', '/servlet/PhenoteStub',{ }) --> - <!-- new Ajax.Autocompleter( 'ontologyname', 'ontologyname_auto_complete', '/servlet/phenote.servlet.PhenoteServlet',{ }) --> - var complete = new Ajax.Autocompleter( 'patoInput', 'pato_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=pato' }) - <!-- complete.options.defaultParams = "ontology=pato"; --> - <!-- complete.options.parameters = "ontology=pato"; --> - <!-- more params? 'ontology=pato&x=y&...' --> - </script> - - <script type="text/javascript"> - new Ajax.Autocompleter( 'entityInput', 'entity_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=anatomy'}) - </script> - - - - <!-- this is set by ncbo-term-info.js but its unclear what its for is this the datamodel???? --> - <input type="hidden" name="ontologyid"> -</form> - -<!-- /td --> - -<!-- td width="80%" --> - <div id="termInfo"></div> -<!-- /td --> - - - -<!-- /td --> -<!-- /tr --> -<!-- tr height="80%" --><!-- td --> <!-- /td --></tr --> -<!-- /table --> - -</body> -</html> - +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<HTML> +<HEAD> + +<TITLE> Phenote </TITLE> + +<!-- we need some way of parameterizing the root of the web files??? --> +<!-- set in some file somewhere? --> + +<link href="../css/control.css" type="text/css" rel="stylesheet"> + +<!-- Ajax stuff (prototype library and friends)--> + +<script src="../javascript/ajax-lib/prototype.js" type="text/javascript"></script> +<script src="../javascript/ajax-lib/effects.js" type="text/javascript"></script> +<script src="../javascript/ajax-lib/dragdrop.js" type="text/javascript"></script> +<script src="../javascript/ajax-lib/controls.js" type="text/javascript"></script> +<!-- /Ajax stuff --> + +<!-- /Custom Javascript --> + +<script src="../javascript/ncbo-term-info.js" type="text/javascript"></script> + + +</HEAD> +<BODY> + +<!-- table width="50%" --> + +<!-- tr height="20%" --> + +<!-- td width="20%" --> + +<form width="20%"> + <div id="ontology" width="20%"> + + <!-- table width="20%" --> + <!-- tr --> + <!-- td --> + + <!-- ENTITY --> + + <!-- div style="float: left;" --> + <div style="float: left;" width="20%"> + + <fieldset class="search"> + <br/><br/><br/> + <label>Entity: </label> + + <!-- input autocomplete="off" id="ontologyname" name="ontologyname" size="20" type="text" value="" / --> + <input autocomplete="off" id="entityInput" name="entityInput" size="40" type="text" value="" /> + </br> + <div class="auto_complete" id="entity_auto_complete"></div> + </fieldset> + + </div> + + <!-- /td --> + <!-- /tr --> + <!-- tr -- --> + <!-- td --> + + <!-- PATO --> + + <div style="clear: left;"> + <!-- div width="20%" --> + + <fieldset class="search"> + <br/><br/><br/> + <label>Quality: </label> + + <!-- input autocomplete="off" id="ontologyname" name="ontologyname" size="20" type="text" value="" / --> + <input autocomplete="off" id="patoInput" name="patoInput" size="40" type="text" value="" /> + </br> + <div class="auto_complete" id="pato_auto_complete"></div> + </fieldset> + + </div> + + <!-- /td --> + <!-- /tr --> + <!-- /table --> + + + </div> + + + + <script type="text/javascript"> + <!-- this is the crucial javascript bit here, patoInput is the --> + <!-- input field, i pato_auto_complete is the div where--> + <!--the auto completion will pop up, and the last param is the--> + <!-- script that will does the fetching of terms --> + <!-- Autocomp is in js/prototype/controls.js --> + <!-- new Ajax.Autocompleter( 'ontologyname', --> + <!-- 'ontologyname_auto_complete', '/phenote-ontology.cgi',{ }) --> + <!-- new Ajax.Autocompleter( 'ontologyname', 'ontologyname_auto_complete', '/servlet/PhenoteStub',{ }) --> + <!-- new Ajax.Autocompleter( 'ontologyname', 'ontologyname_auto_complete', '/servlet/phenote.servlet.PhenoteServlet',{ }) --> + var complete = new Ajax.Autocompleter( 'patoInput', 'pato_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=pato',paramName: "userInput" }) + <!-- complete.options.defaultParams = "ontology=pato"; --> + <!-- complete.options.parameters = "ontology=pato"; --> + <!-- more params? 'ontology=pato&x=y&...' --> + </script> + + <script type="text/javascript"> + new Ajax.Autocompleter( 'entityInput', 'entity_auto_complete', '/phenote/Phenote',{parameters:'ontologyName=anatomy',paramName: "userInput"}) + </script> + + + + <!-- this is set by ncbo-term-info.js but its unclear what its for is this the datamodel???? --> + <input type="hidden" name="ontologyid"> +</form> + +<!-- /td --> + +<!-- td width="80%" --> + <div id="termInfo"></div> +<!-- /td --> + + + +<!-- /td --> +<!-- /tr --> +<!-- tr height="80%" --><!-- td --> <!-- /td --></tr --> +<!-- /table --> + +</body> +</html> + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kev...@us...> - 2006-08-04 23:04:00
|
Revision: 82 Author: kevinschaper Date: 2006-08-04 16:03:57 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=82&view=rev Log Message: ----------- Added scrollbars to terminfo and auto-complete divs. Modified Paths: -------------- phenote/trunk/src/web/css/control.css Modified: phenote/trunk/src/web/css/control.css =================================================================== --- phenote/trunk/src/web/css/control.css 2006-08-04 22:57:16 UTC (rev 81) +++ phenote/trunk/src/web/css/control.css 2006-08-04 23:03:57 UTC (rev 82) @@ -7,6 +7,7 @@ padding: 2px 2px 2px 2px; float: left; width: 300; + overflow: auto; margin: 5px; } @@ -20,7 +21,7 @@ /* div returned from ajax record retreival ---> termInfo delete*/ div#ontologyinfo table { border: 1px solid blue; - width: 100%; + width: 98%; font-size: 14px; background-color: lightgoldenrodyellow; height: 100%; @@ -28,8 +29,9 @@ div#termInfo { float: left; - width: 375; - height: 180; + width: 375px; + height: 500px; + overflow: auto; float: left; border: 1px solid gray; padding: 2px 2px 2px 2px; @@ -76,13 +78,16 @@ /* generated by HTML::Prototype library */ div.auto_complete { width: 350px; + height: 400px; + overflow: auto; background: #fff; + border: 1px solid #888; } div.auto_complete ul { - border:1px solid #888; + margin:0; padding:0; - width:100%; + width:99%; list-style-type:none; } div.auto_complete ul li { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kev...@us...> - 2006-08-04 22:57:18
|
Revision: 81 Author: kevinschaper Date: 2006-08-04 15:57:16 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=81&view=rev Log Message: ----------- Mark fixed print a debug output bug, 'userInput' is now a valid way to send user input from term completion autocompleter. Modified Paths: -------------- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java Modified: phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-07-28 20:47:19 UTC (rev 80) +++ phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-08-04 22:57:16 UTC (rev 81) @@ -54,7 +54,7 @@ if (isTermCompletionRequest(request)) { String userInput = getTermCompletionParam(request); - System.out.println("ontology? "+getOntologyParamString(request)+" param aa? "+request.getParameter("aa")); + System.out.println("ontology? "+getOntologyParamString(request)+" param entityInput? "+request.getParameter("entityInput")); //ResourceBundle r=ResourceBundle.getBundle("LocalStrings",request.getLocale()); //Content-Type: text/html; charset=ISO-8859-1 response.setContentType("text/html"); @@ -65,7 +65,8 @@ // "test</li>\n<li onmouseover=\"set_ontology()\" id=\"termId\" onclick=\"set_ontology()\">dude</li></ul>"; String ontol = getOntologyParamString(request); String list = getCompletionList(userInput,ontol); - System.out.println("printing to response writer: "+list.substring(0,85)+"..."); + int sz = (list.length() <= 85) ? list.length() : 85; + System.out.println("printing to response writer: "+list.substring(0,sz)+"..."); out.println(list); } @@ -77,7 +78,9 @@ /** this should be renamed from unintuitive "ontologyname" */ private String getTermCompletionParam(HttpServletRequest req) { - String par = req.getParameter("patoInput"); // for now + String par = req.getParameter("userInput"); // new way + if (par ==null) + par = req.getParameter("patoInput"); // for now if (par == null) par = req.getParameter("entityInput"); return par; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-07-28 21:48:57
|
Revision: 72 Author: mgibson Date: 2006-07-28 08:07:22 -0700 (Fri, 28 Jul 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=72&view=rev Log Message: ----------- war deploy delete war previous war file - the hot deploy seems to be choking on a straight replace Modified Paths: -------------- phenote/trunk/build.xml Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2006-07-28 15:02:25 UTC (rev 71) +++ phenote/trunk/build.xml 2006-07-28 15:07:22 UTC (rev 72) @@ -218,6 +218,7 @@ </target> <target name="war-no-jar-depend"> + <delete file="war-deployment-link/phenote.war"/> <war destfile="war-deployment-link/phenote.war" webxml="src/web/web.xml"> <fileset dir="src/web"/> <lib dir="${lib}"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-07-28 21:34:57
|
Revision: 77 Author: mgibson Date: 2006-07-28 09:21:27 -0700 (Fri, 28 Jul 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=77&view=rev Log Message: ----------- took out wiping out user input on mouse over of completion list should retain it took out onComplete that was wiping it out Modified Paths: -------------- phenote/trunk/src/web/javascript/ncbo-term-info.js phenote/trunk/src/web/javascript/term_completer.js Modified: phenote/trunk/src/web/javascript/ncbo-term-info.js =================================================================== --- phenote/trunk/src/web/javascript/ncbo-term-info.js 2006-07-28 16:19:53 UTC (rev 76) +++ phenote/trunk/src/web/javascript/ncbo-term-info.js 2006-07-28 16:21:27 UTC (rev 77) @@ -33,7 +33,9 @@ // ontologyinfo is the div where the table goes for term info // note: this is a "get" not a post! (term comp is post) - var myAjax = new Ajax.Updater('termInfo', url, {method: 'get', parameters: pars, onComplete: document.forms[0].patoInput.value = '' } ); + //var myAjax = new Ajax.Updater('termInfo', url, {method: 'get', parameters: pars, onComplete: document.forms[0].patoInput.value = '' } ); + // take out wipe out on complete + var myAjax = new Ajax.Updater('termInfo', url, {method: 'get', parameters: pars } ); // have to have [1] next to form item because the edit subform and // the main form both have donorid elements if ( document.forms[0].ontologyid.length > 1 ) { Modified: phenote/trunk/src/web/javascript/term_completer.js =================================================================== --- phenote/trunk/src/web/javascript/term_completer.js 2006-07-28 16:19:53 UTC (rev 76) +++ phenote/trunk/src/web/javascript/term_completer.js 2006-07-28 16:21:27 UTC (rev 77) @@ -8,7 +8,7 @@ if ( !isNaN( termid ) ) { var pars = 'termid=' + termid; - var myAjax = new Ajax.Updater('terminfo', url, {method: 'get', parameters: pars, onComplete: document.forms[0].term.value = '' } ); + var myAjax = new Ajax.Updater('terminfo', url, {method: 'get', parameters: pars } ); // have to have [1] next to form item because the edit subform and // the main form both have donorid elements if ( document.forms[0].termid.length > 1 ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-07-28 20:47:28
|
Revision: 80 Author: mgibson Date: 2006-07-28 13:47:19 -0700 (Fri, 28 Jul 2006) ViewCVS: http://svn.sourceforge.net/obo/?rev=80&view=rev Log Message: ----------- added in new pato ontology Modified Paths: -------------- phenote/trunk/conf/initial-flybase.cfg phenote/trunk/conf/initial-zfin.cfg phenote/trunk/conf/obd.cfg phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/datamodel/Ontology.java phenote/trunk/src/java/phenote/gui/AutoComboBox.java phenote/trunk/src/web/html/ncbo.html Modified: phenote/trunk/conf/initial-flybase.cfg =================================================================== --- phenote/trunk/conf/initial-flybase.cfg 2006-07-28 20:16:25 UTC (rev 79) +++ phenote/trunk/conf/initial-flybase.cfg 2006-07-28 20:47:19 UTC (rev 80) @@ -7,7 +7,7 @@ <entity name="Anatomy" file="fly_anatomy.obo"/> - <pato file="attribute_and_value.obo"/> + <pato file="quality.obo"/> Modified: phenote/trunk/conf/initial-zfin.cfg =================================================================== --- phenote/trunk/conf/initial-zfin.cfg 2006-07-28 20:16:25 UTC (rev 79) +++ phenote/trunk/conf/initial-zfin.cfg 2006-07-28 20:47:19 UTC (rev 80) @@ -6,7 +6,7 @@ <entity name="Anatomy" file="zebrafish_anatomy.obo"/> - <pato file="attribute_and_value.obo"/> + <pato file="quality.obo"/> Modified: phenote/trunk/conf/obd.cfg =================================================================== --- phenote/trunk/conf/obd.cfg 2006-07-28 20:16:25 UTC (rev 79) +++ phenote/trunk/conf/obd.cfg 2006-07-28 20:47:19 UTC (rev 80) @@ -10,7 +10,7 @@ <ontology name="GO" file="gene_ontology.obo"/> </entity> - <pato file="attribute_and_value.obo"/> + <pato file="quality.obo"/> Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2006-07-28 20:16:25 UTC (rev 79) +++ phenote/trunk/src/java/phenote/config/Config.java 2006-07-28 20:47:19 UTC (rev 80) @@ -91,6 +91,7 @@ /** paot config should always be present, make default if not set from xml */ private FieldConfig getPatoConfig() { if (patoConfig == null) { + System.out.println("error pato config is null, making default"); OntologyConfig o = OntologyConfig.defaultPato; patoConfig = new FieldConfig(CharFieldEnum.PATO,o); } @@ -252,7 +253,8 @@ private void parsePato(Node node) { if (!node.getNodeName().equals("pato")) return; OntologyConfig oc = makeOntologyConfig(node,"Pato"); - getPatoConfig().addOntologyConfig(oc); + //getPatoConfig().addOntologyConfig(oc); + patoConfig = new FieldConfig(CharFieldEnum.PATO,oc); } private void parseEntity(Node node) { Modified: phenote/trunk/src/java/phenote/datamodel/Ontology.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/Ontology.java 2006-07-28 20:16:25 UTC (rev 79) +++ phenote/trunk/src/java/phenote/datamodel/Ontology.java 2006-07-28 20:47:19 UTC (rev 80) @@ -101,8 +101,9 @@ // SKIP PATO ATTRIBUTES - only want values - or do !contains "value"? // yes do contains value - as theres other crap to filter too - if (filterAttributes() && isAttribute(originalTerm)) - continue; + // apparently curators want to see attribs as well according to Michael + //if (filterAttributes() && isAttribute(originalTerm)) + //continue; if (searchParams.searchTerms()) { // adds originalTerm to searchTerms if match (1st if exact) @@ -142,7 +143,7 @@ } // part of search params? - private boolean filterAttributes() { return isPato(); } + //private boolean filterAttributes() { return isPato(); } // make enum!! private boolean isPato() { Modified: phenote/trunk/src/java/phenote/gui/AutoComboBox.java =================================================================== --- phenote/trunk/src/java/phenote/gui/AutoComboBox.java 2006-07-28 20:16:25 UTC (rev 79) +++ phenote/trunk/src/java/phenote/gui/AutoComboBox.java 2006-07-28 20:47:19 UTC (rev 80) @@ -133,6 +133,8 @@ /** This gets obo class selected in completion list - not from text box Returns null if nothing selected - can happen amidst changing selection */ private OBOClass getSelectedCompListOboClass() { + if (defaultComboBoxModel == null) + return null; Object obj = defaultComboBoxModel.getSelectedItem(); if (obj == null) return null; Modified: phenote/trunk/src/web/html/ncbo.html =================================================================== --- phenote/trunk/src/web/html/ncbo.html 2006-07-28 20:16:25 UTC (rev 79) +++ phenote/trunk/src/web/html/ncbo.html 2006-07-28 20:47:19 UTC (rev 80) @@ -67,7 +67,7 @@ <fieldset class="search"> <br/><br/><br/> - <label>PATO: </label> + <label>Quality: </label> <!-- input autocomplete="off" id="ontologyname" name="ontologyname" size="20" type="text" value="" / --> <input autocomplete="off" id="patoInput" name="patoInput" size="20" type="text" value="" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |