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-11-17 18:29:13
|
Revision: 205 http://svn.sourceforge.net/obo/?rev=205&view=rev Author: mgibson Date: 2006-11-17 10:29:07 -0800 (Fri, 17 Nov 2006) Log Message: ----------- added web page for phenote web home - so can be mutually modified by nicole & i Added Paths: ----------- phenote/trunk/doc/phenote-web-site/ phenote/trunk/doc/phenote-web-site/phenote.html Added: phenote/trunk/doc/phenote-web-site/phenote.html =================================================================== --- phenote/trunk/doc/phenote-web-site/phenote.html (rev 0) +++ phenote/trunk/doc/phenote-web-site/phenote.html 2006-11-17 18:29:07 UTC (rev 205) @@ -0,0 +1,117 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> +<head> + <meta content="text/html; charset=ISO-8859-1" + http-equiv="content-type"> + <title>Phenote</title> +</head> +<body> +<h1 style="text-align: left;"><span style="font-weight: bold;"></span>Phenote<br> +</h1> +<br> +Phenote is a tool to annotate phenotypes using the Entity Quality +paradigm. It takes advantage of +ontologies. It uses term completion to allow curators quick access to +the ontology terms they want to use. <br> +<br> +<a href="0.9/phenote-flybase.jnlp">Phenote 0.9 for fly</a><br> +<br> +<a href="0.9/phenote-zfin.jnlp">Phenote (standalone) 0.9 for zfin</a><br> +<br> +To be clear the above webstart links for zfin & fly were made via +configuration not hard wired code. Thus one could in theory configure +phenote for ones own purposes.<br> +<br> +Recent addditions include the ability to post compose terms, bul +update, undo, spring framework, and +synonyms now are shown in the completion list.<br> +<br> +Zebrafish requires +components of phenote(to plug into their non-public +website), not a full web app. Here is a proof of concept of some of +those +components:<br> +<br> +<a href="http://reaper.lbl.gov/phenote/html/ncbo.html">Webby +Phenote(components used by Zfin)</a><br> +<br> +Webby phenote is a collaboration with Sohel Merchant at DichtyBase. +Here is what they have done:<br> +<br> +<a + href="http://165.124.152.194/db/cgi-bin/dictyBase/curation/phenotypeCuration.pl">DichtyBase +webby phenote</a><br> +<br> +<br> +I am doing these +releases to get feedback. Please report any bugs (ideally through the <a + href="https://sourceforge.net/tracker/?group_id=76834&atid=887913">bug +tracker</a>) and let me know what you +think (mg...@fr...).<br> +<h4>Phenote links:<br> +</h4> +<a href="https://lists.sourceforge.net/lists/listinfo/obo-phenote">Phenote +email list</a><br> +<a href="https://sourceforge.net/tracker/?group_id=76834&atid=887913">Phenote +bug tracker</a><br> +<a + href="https://lists.sourceforge.net/lists/listinfo/obo-phenote-bug-tracker">Bug +tracker email list</a><br> +<a href="https://sourceforge.net/svn/?group_id=76834">Phenote source +code (obo sourceforge svn)</a><br> +<a href="https://lists.sourceforge.net/lists/listinfo/obo-svn-commit">Phenote +svn commit email list</a><br> +<a + href="http://wiki.dictybase.org/dictywiki/index.php/Phenotype_Curation_Tool_Documentation#Usage">Dichty +webby phenote wiki developer docs</a><br> +<a + href="http://www.bioontology.org/wiki-internal/index.php/Phenotype_Annotation_Tool">Phenote +ncbo internal wiki (ncbo folk only)</a><br> +<br> +<a href="phenote-release-notes.html">Phenote Release Notes and old +webstart releases</a><br> +<br> +If the Phenote webstart link fails to do anything, then there are +probably problems +with webstart and/or java(has to be jdk 1.5). Take a look at my <a + href="webstart-troubleshooting.html">webstart troubleshooting</a><br> +page.<br> +<br> +Click here for <a href="phenote-java-requirements.html">phenote java +requirements</a><br> +<br> +<br> +<br> +Old releases: <br> +<br> +<a href="0.8/phenote-flybase.jnlp">Phenote 0.8 for fly.</a><br> +<a href="0.8/phenote-zfin.jnlp">Phenote (standalone) 0.8 for zfin</a><br> +<br> +<a href="0.7/phenote-flybase.jnlp">Phenote 0.7 for fly.</a><br> +<a href="0.7/phenote-zfin.jnlp">Phenote (standalone) 0.7 for zfin</a><br> +<br> +<a href="0.6/phenote-flybase.jnlp">Phenote 0.6 with fly anatomy</a><br> +<br> +<a href="0.6/phenote-zfin.jnlp">Phenote 0.6 with zebrafish anatomy</a><br> +<br> +<a href="0.5/phenote-flybase.jnlp">Phenote 0.5 webstart for FlyBase</a><br> +<br> +<a href="0.5/phenote-zfin.jnlp">Phenote 0.5 webstart for ZFIN</a><br> +<br> +<a href="0.4/phenote-flybase.jnlp">Phenote 0.4 webstart for FlyBase</a><br> +<br> +<a href="0.4/phenote-zfin.jnlp">Phenote 0.4 webstart for ZFIN</a><br> +<br> +<a href="0.3.1/phenote-webstart.jnlp">Phenote for CToL group (0.3.1)</a> +(a special release for the CToL group that uses fish +taxonomy)<br> +<br> +<a href="0.3/phenote-webstart.jnlp">Phenote 0.3</a><br> +<br> +<a href="0.2/phenote-webstart.jnlp">Phenote 0.2</a><br> +<br> +<a href="0.1/phenote-webstart.jnlp">Phenote 0.1</a><br> +<br> +<br> +</body> +</html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-17 17:27:14
|
Revision: 204 http://svn.sourceforge.net/obo/?rev=204&view=rev Author: mgibson Date: 2006-11-17 09:27:07 -0800 (Fri, 17 Nov 2006) Log Message: ----------- release 0.9 - undo, bulk copy/edit, spring, quartz Added Paths: ----------- phenote/tags/release-0.9/ Copied: phenote/tags/release-0.9 (from rev 203, phenote/trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-17 16:23:14
|
Revision: 203 http://svn.sourceforge.net/obo/?rev=203&view=rev Author: mgibson Date: 2006-11-17 08:04:53 -0800 (Fri, 17 Nov 2006) Log Message: ----------- deleting last blank row was causing a false transaction and false transactions cause undos that do nothing Modified Paths: -------------- phenote/trunk/src/java/phenote/datamodel/Character.java phenote/trunk/src/java/phenote/datamodel/CharacterI.java phenote/trunk/src/java/phenote/edit/EditManager.java phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java Modified: phenote/trunk/src/java/phenote/datamodel/Character.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/Character.java 2006-11-17 15:27:16 UTC (rev 202) +++ phenote/trunk/src/java/phenote/datamodel/Character.java 2006-11-17 16:04:53 UTC (rev 203) @@ -60,5 +60,17 @@ return (Character)clone(); } catch (CloneNotSupportedException e) { return null; } } + + public boolean hasNoContent() { + if (hasPub()) return false; + if (genotype!=null && !genotype.equals("")) return false; + if (entity != null) return false; + if (quality != null) return false; + return geneticContext == null; + } + public String toString() { + return "Pub "+pub+" genotype "+genotype+" gen ctxt "+geneticContext+" entity "+ + entity+" qual "+quality; + } } Modified: phenote/trunk/src/java/phenote/datamodel/CharacterI.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharacterI.java 2006-11-17 15:27:16 UTC (rev 202) +++ phenote/trunk/src/java/phenote/datamodel/CharacterI.java 2006-11-17 16:04:53 UTC (rev 203) @@ -32,4 +32,5 @@ public CharacterI cloneCharacter(); public boolean equals(CharacterI c); + public boolean hasNoContent(); } Modified: phenote/trunk/src/java/phenote/edit/EditManager.java =================================================================== --- phenote/trunk/src/java/phenote/edit/EditManager.java 2006-11-17 15:27:16 UTC (rev 202) +++ phenote/trunk/src/java/phenote/edit/EditManager.java 2006-11-17 16:04:53 UTC (rev 203) @@ -120,7 +120,7 @@ private void addTransaction(TransactionI t) { transactionList.add(t); - //System.out.println("got trans "+t); + //System.out.println("got trans "+t); new Throwable().printStackTrace(); } private void fireChangeEvent(CharChangeEvent e) { Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-17 15:27:16 UTC (rev 202) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-17 16:04:53 UTC (rev 203) @@ -182,6 +182,13 @@ be made - at least for sandbox mode. */ boolean hasRows() { return characterTableModel.hasRows(); } + private boolean hasOneEmptySelectedRow() { + if (getCharacterList().size() > 1) return false; + if (getSelectedChars().size() != 1) return false; // shouldnt happen + CharacterI c = getSelectedChars().get(0); + return c.hasNoContent(); // method name?? + } + private void scrollToLastRow() { verticalScrollBar.setValue(verticalScrollBar.getMaximum()+20); } @@ -212,6 +219,10 @@ scrollToNewLastRowOnRepaint = true;//scrollToLastRow(); // scroll to new row } else if (e.getActionCommand().equals("Delete")) { + // if just deleting first blank row dont do anything otherwise get "false" trans + if (hasOneEmptySelectedRow()) + return; + selectRow = getSelectedRow(); //characterTableModel.deleteSelectedRow(selectRow); // this will cause a valueChanged() to CharSelListener when things arent in @@ -290,7 +301,6 @@ independently... */ private class TableCharChangeListener implements CharChangeListener { public void charChanged(CharChangeEvent e) { - System.out.println("is update "+e.isUpdate()+"- calling repaint"); if (e.isUpdate()) { repaint(); // repaint causes new cell val to get displayed return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-17 15:27:24
|
Revision: 202 http://svn.sourceforge.net/obo/?rev=202&view=rev Author: mgibson Date: 2006-11-17 07:27:16 -0800 (Fri, 17 Nov 2006) Log Message: ----------- fixed undo selection bug - after undo 1st row was getting selected no matter what also fixed bug after undoing copy or new left with no selection - now selects last row - dont think there should ever be no selection Modified Paths: -------------- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java phenote/trunk/src/java/phenote/main/PhenoteVersion.java Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-16 23:28:15 UTC (rev 201) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-17 15:27:16 UTC (rev 202) @@ -133,8 +133,11 @@ /** row number is zero based for tables */ private void selectRow(int row) { - if (charJTable != null && row >= 0 && row < charJTable.getRowCount()) - charJTable.setRowSelectionInterval(row,row); + if (charJTable == null) return; + if (row < 0) row = 0; // ??? + if (row >= charJTable.getRowCount()) row = charJTable.getRowCount() - 1; + //if (charJTable != null && row >= 0 && row < charJTable.getRowCount()) + charJTable.setRowSelectionInterval(row,row); } private void selectRows(RowInterval selRows) { @@ -191,6 +194,7 @@ public void actionPerformed(ActionEvent e) { int selectRow = 0; RowInterval selectRows=null; + boolean doSelection = true; if (e.getActionCommand().equals("New")) { selectRow = characterTableModel.addNewBlankRow(); scrollToNewLastRowOnRepaint = true;//scrollToLastRow(); // scroll to new row @@ -234,6 +238,8 @@ // UNDO else if (e.getActionCommand().equals("Undo")) { + // let char change deal with selection i think?? undo is different + doSelection = false; EditManager.inst().undo(); } @@ -248,7 +254,7 @@ } if (selectRows != null) // multi select selectRows(selectRows); - else // single row select + else if (doSelection) // single row select selectRow(selectRow); repaint(); // check whether enable/disable del & copy buttons - disable w no rows @@ -284,6 +290,7 @@ independently... */ private class TableCharChangeListener implements CharChangeListener { public void charChanged(CharChangeEvent e) { + System.out.println("is update "+e.isUpdate()+"- calling repaint"); if (e.isUpdate()) { repaint(); // repaint causes new cell val to get displayed return; Modified: phenote/trunk/src/java/phenote/main/PhenoteVersion.java =================================================================== --- phenote/trunk/src/java/phenote/main/PhenoteVersion.java 2006-11-16 23:28:15 UTC (rev 201) +++ phenote/trunk/src/java/phenote/main/PhenoteVersion.java 2006-11-17 15:27:16 UTC (rev 202) @@ -6,7 +6,7 @@ //private static final float MAJOR_VERSION_NUM = 0.8f; //private static final float SUB_VERSION_NUM = .3f; - private static final String VERSION = "0.9.1 dev"; // ?? + private static final String VERSION = "0.9.2 dev"; // ?? // type is "dev" or "release" //private static final String type = " dev"; // "release" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-16 23:28:17
|
Revision: 201 http://svn.sourceforge.net/obo/?rev=201&view=rev Author: mgibson Date: 2006-11-16 15:28:15 -0800 (Thu, 16 Nov 2006) Log Message: ----------- undo is no longer so awkward for free text fields where before it was undoing letter by letter - not it undoes the all things typed until focus changes which is usually the whole field - well in any case its the last chunk of text the user added to the field this was done by doing the commits to model on focus change rather than key types - which i think is fine - this will also work for checks to see if the input is proper like : for dbxref ids broke out free text field from char field gui - its a has a not a isa - wasnt sure though Modified Paths: -------------- phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java Added Paths: ----------- phenote/trunk/src/java/phenote/gui/field/FreeTextField.java Modified: phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java 2006-11-11 00:18:18 UTC (rev 200) +++ phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java 2006-11-16 23:28:15 UTC (rev 201) @@ -1,19 +1,16 @@ package phenote.gui.field; -import java.util.List; -import java.awt.Toolkit; +//import java.util.List; +//import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.Container; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.Transferable; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.event.DocumentListener; -import javax.swing.event.DocumentEvent; +//import javax.swing.JTextField; +//import javax.swing.event.DocumentListener; +//import javax.swing.event.DocumentEvent; import org.apache.log4j.Logger; @@ -28,9 +25,9 @@ import phenote.datamodel.OntologyManager; import phenote.edit.CharChangeEvent; import phenote.edit.CharChangeListener; -import phenote.edit.CompoundTransaction; +//import phenote.edit.CompoundTransaction; import phenote.edit.EditManager; -import phenote.edit.UpdateTransaction; +//import phenote.edit.UpdateTransaction; import phenote.gui.selection.CharSelectionListener; import phenote.gui.selection.CharSelectionEvent; import phenote.gui.selection.SelectionManager; @@ -45,7 +42,8 @@ private RelationCompList relCompList; private TermCompList termCompList; private CompListSearcher compListSearcher; - private JTextField textField; + //private JTextField textField; + private FreeTextField freeTextField; private boolean isCompList = false; private CharField charField; private FieldPanel fieldPanel; @@ -97,6 +95,8 @@ EditManager.inst().addCharChangeListener(new FieldCharChangeListener()); } + boolean updateGuiOnly() { return updateGuiOnly; } + /** edits from post comp come in here i believe (term info used to but now thats done with UseTermEvent) */ private class FieldCharChangeListener implements CharChangeListener { @@ -247,46 +247,46 @@ private void initTextField(String label) { isCompList = false; fieldPanel.addLabel(label); - textField = new JTextField(25); - textField.setEditable(true); - // addGenericDocumentListener... - textField.getDocument().addDocumentListener(new TextFieldDocumentListener()); - fieldPanel.addFieldGui(textField); + freeTextField = new FreeTextField(this); +// textField = new JTextField(25); +// textField.setEditable(true); +// textField.getDocument().addDocumentListener(new TextFieldDocumentListener()); +// textField.addKeyListener(new TextKeyListener()); + fieldPanel.addFieldGui(freeTextField.getComponent()); + } - textField.addKeyListener(new TextKeyListener()); + private FreeTextField getFreeTextField() { return freeTextField; } - } +// /** key listener for free text fields for Cmd-V pasting for macs */ +// private class TextKeyListener extends java.awt.event.KeyAdapter { +// public void keyPressed(java.awt.event.KeyEvent e) { +// // on a mac Command-V is paste. this aint so with java/metal look&feel +// if (e.getKeyChar() == 'v' +// && e.getKeyModifiersText(e.getModifiers()).equals("Command")) { +// //log().debug("got cmd V paste"); +// //System.getClipboard +// Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); +// try { +// Transferable t = c.getContents(null); // null? +// Object s = t.getTransferData(DataFlavor.stringFlavor); +// // this isnt quite right as it should just insert the text not wipe +// // it out - but probably sufficient for now? +// if (s != null) +// setText(s.toString()); +// } catch (Exception ex) { System.out.println("failed paste "+ex); } +// } +// } +// } - /** key listener for free text fields for Cmd-V pasting for macs */ - private class TextKeyListener extends java.awt.event.KeyAdapter { - public void keyPressed(java.awt.event.KeyEvent e) { - // on a mac Command-V is paste. this aint so with java/metal look&feel - if (e.getKeyChar() == 'v' - && e.getKeyModifiersText(e.getModifiers()).equals("Command")) { - //log().debug("got cmd V paste"); - //System.getClipboard - Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); - try { - Transferable t = c.getContents(null); // null? - Object s = t.getTransferData(DataFlavor.stringFlavor); - // this isnt quite right as it should just insert the text not wipe - // it out - but probably sufficient for now? - if (s != null) - setText(s.toString()); - } catch (Exception ex) { System.out.println("failed paste "+ex); } - } - } - } - void setText(String text) { // set/getText interface to combo & text field? if (isCompList) getCompList().setText(text); - else textField.setText(text); + else getFreeTextField().setText(text); } String getText() { if (isCompList) return getCompList().getText(); - else return textField.getText(); + else return getFreeTextField().getText(); } /** clears gui not model - for multi select - may want to set to * or something? */ void setGuiForMultiSelect() { @@ -319,34 +319,34 @@ return SelectionManager.inst().getFirstSelectedCharacter(); } - private List<CharacterI> getSelectedChars() { - return SelectionManager.inst().getSelectedChars(); - } +// List<CharacterI> getSelectedChars() { +// return SelectionManager.inst().getSelectedChars(); +// } - // separate char text field class? - /** This is where the model gets updated (for free text fields) */ - private class TextFieldDocumentListener implements DocumentListener { - //private String previousVal = null; - public void changedUpdate(DocumentEvent e) { updateModel(); } - public void insertUpdate(DocumentEvent e) { updateModel(); } - public void removeUpdate(DocumentEvent e) { updateModel(); } - private void updateModel() { - // if only updating gui (multi select clear) then dont update model - if (updateGuiOnly) return; - // on delete last pheno row clearing of text will trigger this - //if (!characterTablePanel.hasRows()) return; - //String genotype = lumpField.getText(); - //characterTablePanel.setSelectedGenotype(genotype); - List<CharacterI> chars = getSelectedChars(); - // i believe this isnt using oboClass as we just have string - // of course it isnt this is free text - String v = getText(); - //UpdateTransaction ut = new UpdateTransaction(char,getCharFieldEnum(),v); - CompoundTransaction ct = new CompoundTransaction(chars,getCharFieldEnum(),v); - EditManager.inst().updateModel(CharFieldGui.this,ct); - //previousVal = v; // undo - } - } +// // separate char text field class? +// /** This is where the model gets updated (for free text fields) */ +// private class TextFieldDocumentListener implements DocumentListener { +// //private String previousVal = null; +// public void changedUpdate(DocumentEvent e) { updateModel(); } +// public void insertUpdate(DocumentEvent e) { updateModel(); } +// public void removeUpdate(DocumentEvent e) { updateModel(); } +// private void updateModel() { +// // if only updating gui (multi select clear) then dont update model +// if (updateGuiOnly) return; +// // on delete last pheno row clearing of text will trigger this +// //if (!characterTablePanel.hasRows()) return; +// //String genotype = lumpField.getText(); +// //characterTablePanel.setSelectedGenotype(genotype); +// List<CharacterI> chars = getSelectedChars(); +// // i believe this isnt using oboClass as we just have string +// // of course it isnt this is free text +// String v = getText(); +// //UpdateTransaction ut = new UpdateTransaction(char,getCharFieldEnum(),v); +// CompoundTransaction ct = new CompoundTransaction(chars,getCharFieldEnum(),v); +// EditManager.inst().updateModel(CharFieldGui.this,ct); +// //previousVal = v; // undo +// } +// } private class FieldCharSelectListener implements CharSelectionListener { public void charactersSelected(CharSelectionEvent e) { Added: phenote/trunk/src/java/phenote/gui/field/FreeTextField.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/FreeTextField.java (rev 0) +++ phenote/trunk/src/java/phenote/gui/field/FreeTextField.java 2006-11-16 23:28:15 UTC (rev 201) @@ -0,0 +1,104 @@ +package phenote.gui.field; + +import java.util.List; +import java.awt.Toolkit; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import javax.swing.JTextField; +import javax.swing.event.DocumentListener; +import javax.swing.event.DocumentEvent; + +import phenote.datamodel.CharacterI; +import phenote.datamodel.CharFieldEnum; +import phenote.edit.CompoundTransaction; +import phenote.edit.EditManager; +import phenote.gui.selection.SelectionManager; + +// should this be a subclass of charfieldGui? maybe? +class FreeTextField { + + private JTextField textField; + private CharFieldGui charFieldGui; + private boolean guiTextHasChanged = false; + + //private void initTextField(String label) { + FreeTextField(CharFieldGui cfg) { + charFieldGui = cfg; + textField = new JTextField(25); + textField.setEditable(true); + textField.getDocument().addDocumentListener(new TextFieldDocumentListener()); + textField.addFocusListener(new FreeFocusListener()); + textField.addKeyListener(new TextKeyListener()); + } + + JTextField getComponent() { return textField; } + + void setText(String text) { + textField.setText(text); + } + String getText() { return textField.getText(); } + + private boolean updateGuiOnly() { return charFieldGui.updateGuiOnly(); } + + /** key listener for free text fields for Cmd-V pasting for macs */ + private class TextKeyListener extends KeyAdapter { + public void keyPressed(KeyEvent e) { + // on a mac Command-V is paste. this aint so with java/metal look&feel + if (e.getKeyChar() == 'v' + && e.getKeyModifiersText(e.getModifiers()).equals("Command")) { + //log().debug("got cmd V paste"); + //System.getClipboard + Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); + try { + Transferable t = c.getContents(null); // null? + Object s = t.getTransferData(DataFlavor.stringFlavor); + // this isnt quite right as it should just insert the text not wipe + // it out - but probably sufficient for now? + if (s != null) + setText(s.toString()); + } catch (Exception ex) { System.out.println("failed paste "+ex); } + } + } + } + + /** if the focus has changed and the gui has been edited then edit the model */ + private class FreeFocusListener implements FocusListener { + public void focusGained(FocusEvent e) {} + public void focusLost(FocusEvent e) { + updateModel(); + } + } + + private void updateModel() { + // if only updating gui (multi select clear) then dont update model + if (updateGuiOnly()) return; + if (!guiTextHasChanged) return; // gui hasnt been edited + List<CharacterI> chars = getSelectedChars(); + String v = getText(); + CompoundTransaction ct = new CompoundTransaction(chars,getCharFieldEnum(),v); + EditManager.inst().updateModel(charFieldGui,ct); // cfg source + guiTextHasChanged = false; // reset flag + } + + private List<CharacterI> getSelectedChars() { + return SelectionManager.inst().getSelectedChars(); + } + + private CharFieldEnum getCharFieldEnum() { return charFieldGui.getCharFieldEnum(); } + + + /** This is where it is noted that the gui has been edited, only update + the model on focus change if the gui has been actually edited */ + private class TextFieldDocumentListener implements DocumentListener { + public void changedUpdate(DocumentEvent e) { setGuiChanged(); } + public void insertUpdate(DocumentEvent e) { setGuiChanged(); } + public void removeUpdate(DocumentEvent e) { setGuiChanged(); } + private void setGuiChanged() { guiTextHasChanged = true; } + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2006-11-11 00:18:25
|
Revision: 200 http://svn.sourceforge.net/obo/?rev=200&view=rev Author: cmpich Date: 2006-11-10 16:18:18 -0800 (Fri, 10 Nov 2006) Log Message: ----------- Fixed bug in File copy: The system would hang during the creation of the archive file. Also, I moved the log4j.xml file into the WEB-INF directory for easier access. Modified Paths: -------------- phenote/trunk/src/java/phenote/jobs/OntologyUpdateJob.java phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java phenote/trunk/src/java/phenote/util/FileUtil.java phenote/trunk/src/web/WEB-INF/phenote-servlet.xml Added Paths: ----------- phenote/trunk/src/web/WEB-INF/log4j.xml Removed Paths: ------------- phenote/trunk/conf/log4j.xml Deleted: phenote/trunk/conf/log4j.xml =================================================================== --- phenote/trunk/conf/log4j.xml 2006-11-10 22:54:28 UTC (rev 199) +++ phenote/trunk/conf/log4j.xml 2006-11-11 00:18:18 UTC (rev 200) @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> -<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> - - <appender name="MAIN" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="phenote_log4j.log" /> - <param name="Append" value="true" /> - <param name="MaxFileSize" value="1MB" /> - <param name="MaxBackupIndex" value="10" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> - </layout> - </appender> - - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> - </layout> - </appender> - - <category name="phenote" additivity="true"> - <priority value="info"/> - <appender-ref ref="MAIN" /> - </category> - - <root> - <priority value="info" /> - <appender-ref ref="MAIN" /> - </root> -</log4j:configuration> - Modified: phenote/trunk/src/java/phenote/jobs/OntologyUpdateJob.java =================================================================== --- phenote/trunk/src/java/phenote/jobs/OntologyUpdateJob.java 2006-11-10 22:54:28 UTC (rev 199) +++ phenote/trunk/src/java/phenote/jobs/OntologyUpdateJob.java 2006-11-11 00:18:18 UTC (rev 200) @@ -29,7 +29,7 @@ protected void executeInternal(JobExecutionContext context) throws JobExecutionException { - LOG.info("Started Ontology Update Job"); + LOG.info("Started Ontology Update Job: " + ontologyName); try { Ontology ontology = OntologyManager.inst().getOntologyForName(ontologyName); Modified: phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-11-10 22:54:28 UTC (rev 199) +++ phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java 2006-11-11 00:18:18 UTC (rev 200) @@ -1,7 +1,10 @@ package phenote.servlet; +import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import org.apache.commons.lang.StringUtils; +import org.apache.log4j.PatternLayout; +import org.apache.log4j.RollingFileAppender; +import org.apache.log4j.xml.DOMConfigurator; import org.springframework.web.servlet.DispatcherServlet; import phenote.config.Config; import phenote.config.ConfigException; @@ -10,11 +13,15 @@ import javax.servlet.ServletConfig; import javax.servlet.ServletException; +import java.io.File; +import java.io.IOException; public class PhenoteServlet extends DispatcherServlet { private static final String CONFIG_FILE_PARAM = "configuration-file"; private static final Logger LOG = Logger.getLogger(PhenoteServlet.class); + private static final String LOG4J_FILE_NAME = "log4j.xml"; + private static String webInfDir; /** * Initialization of this servlet upon server startup. @@ -25,6 +32,8 @@ */ public void init(ServletConfig config) throws ServletException { super.init(config); + webInfDir = getServletContext().getRealPath("/WEB-INF/"); + PhenoteWebConfiguration.getInstance().setWebRoot(getServletContext().getRealPath("/")); // ToDo: @@ -49,7 +58,46 @@ // before a different client calls and has to wait. // ToDo: Shall we create a new method called OntologyDataAdapter.start()? YES OntologyDataAdapter.initialize(); + + initLog4j(); } + private void initLog4j() { + String log4jFileName = getLog4JFile(); + // if the log4j-init-file is set do not initialize log4j. + if (log4jFileName != null) { + DOMConfigurator.configure(log4jFileName); + } + addRootAppender(); + } + + private String getLog4JFile() { + File log4jFile = new File(webInfDir, LOG4J_FILE_NAME); + String log4jFileName = log4jFile.getAbsolutePath(); + if (!log4jFile.exists()) + System.out.println("Cannot find log4j file: " + log4jFileName); + return log4jFileName; + } + + private void addRootAppender() { + Logger rootLogger = Logger.getRootLogger(); + + String logFileName = "phenote.log"; + File file = new File(webInfDir, logFileName); + String absoluteFilePath = file.getAbsolutePath(); + RollingFileAppender appender = null; + try { + String logFilePattern = "%d [%t] %-5p %c{2} - %m%n"; + appender = new RollingFileAppender(new PatternLayout(logFilePattern), absoluteFilePath); + appender.setMaximumFileSize(1 * 1024 * 1024); + appender.setAppend(true); + appender.setMaxBackupIndex(10); + } catch (IOException e) { + e.printStackTrace(); + } + rootLogger.addAppender(appender); + } + + } Modified: phenote/trunk/src/java/phenote/util/FileUtil.java =================================================================== --- phenote/trunk/src/java/phenote/util/FileUtil.java 2006-11-10 22:54:28 UTC (rev 199) +++ phenote/trunk/src/java/phenote/util/FileUtil.java 2006-11-11 00:18:18 UTC (rev 200) @@ -1,17 +1,16 @@ package phenote.util; +import org.apache.log4j.Logger; + import java.io.*; import java.net.MalformedURLException; import java.net.URL; +import java.nio.channels.FileChannel; import java.util.ArrayList; +import java.util.Calendar; +import java.util.GregorianCalendar; import java.util.List; -import java.util.GregorianCalendar; -import java.util.Calendar; -import java.nio.channels.FileChannel; -import java.nio.ByteBuffer; -import org.apache.log4j.Logger; - public class FileUtil { public static final String FILE_SEPARATOR = System.getProperty("file.separator"); @@ -128,19 +127,26 @@ return archiveFile; } - private static boolean copyFileIntoArchive(File file, File archiveFile) { + /** + * Copy one file into another file. + * + * @param file + * @param archiveFile + */ + synchronized private static boolean copyFileIntoArchive(File file, File archiveFile) { boolean success = true; FileInputStream fis = null; FileOutputStream fos = null; try { - fis = new FileInputStream(file); - fos = new FileOutputStream(archiveFile); - FileChannel inChannel = fis.getChannel(); - ByteBuffer buffer = ByteBuffer.allocate(48); - FileChannel outChannel = fos.getChannel(); - while (inChannel.read(buffer) != -1) { - outChannel.write(buffer); - } + fis = new FileInputStream(file); + fos = new FileOutputStream(archiveFile); + FileChannel inChannel = fis.getChannel(); + FileChannel outChannel = fos.getChannel(); + int bytesWritten = 0; + long byteCount = 0; + while(bytesWritten < byteCount) + bytesWritten +=inChannel.transferTo(bytesWritten, byteCount - bytesWritten, outChannel); + fos.close(); fis.close(); Added: phenote/trunk/src/web/WEB-INF/log4j.xml =================================================================== --- phenote/trunk/src/web/WEB-INF/log4j.xml (rev 0) +++ phenote/trunk/src/web/WEB-INF/log4j.xml 2006-11-11 00:18:18 UTC (rev 200) @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> +<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> + + <appender name="MAIN" class="org.apache.log4j.RollingFileAppender"> + <param name="File" value="phenote_log4j.log" /> + <param name="Append" value="true" /> + <param name="MaxFileSize" value="1MB" /> + <param name="MaxBackupIndex" value="10" /> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> + </layout> + </appender> + + <appender name="console" class="org.apache.log4j.ConsoleAppender"> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %-5p %c{2} - %m%n"/> + </layout> + </appender> + + <category name="phenote" additivity="true"> + <priority value="info"/> + <appender-ref ref="MAIN" /> + </category> + + <root> + <priority value="info" /> + <appender-ref ref="MAIN" /> + </root> +</log4j:configuration> + Modified: phenote/trunk/src/web/WEB-INF/phenote-servlet.xml =================================================================== --- phenote/trunk/src/web/WEB-INF/phenote-servlet.xml 2006-11-10 22:54:28 UTC (rev 199) +++ phenote/trunk/src/web/WEB-INF/phenote-servlet.xml 2006-11-11 00:18:18 UTC (rev 200) @@ -69,6 +69,27 @@ </property> </bean> + <bean id="qualityOntologyReloadJob" class="org.springframework.scheduling.quartz.JobDetailBean"> + <property name="jobClass"> + <value>phenote.jobs.OntologyUpdateJob</value> + </property> + <property name="jobDataAsMap"> + <map> + <entry key="ontologyName"> + <value>Quality</value> + </entry> + <!-- This directory is relative to the webroot --> + <entry key="archiveDirectory"> + <value>archive-ontology</value> + </entry> + <!-- time stated in days (can be a fraction) --> + <entry key="purgePeriodInDays"> + <value>0.0035</value> + </entry> + </map> + </property> + </bean> + <bean id="cronAOTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail"> <ref bean="anatomyOntologyReloadJob"/> @@ -78,10 +99,30 @@ </property> </bean> + <bean id="cronGOTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> + <property name="jobDetail"> + <ref bean="geneOntologyReloadJob"/> + </property> + <property name="cronExpression"> + <value>40 * * * * ?</value> + </property> + </bean> + + <bean id="cronQualityTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> + <property name="jobDetail"> + <ref bean="qualityOntologyReloadJob"/> + </property> + <property name="cronExpression"> + <value>0 * * * * ?</value> + </property> + </bean> + <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="cronAOTrigger"/> + <ref bean="cronGOTrigger"/> + <ref bean="cronQualityTrigger"/> </list> </property> </bean> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-10 22:54:32
|
Revision: 199 http://svn.sourceforge.net/obo/?rev=199&view=rev Author: mgibson Date: 2006-11-10 14:54:28 -0800 (Fri, 10 Nov 2006) Log Message: ----------- new is now undoable theres actually 2 news - the initial blank new which you can get back to by deleting everything and thats a fundamentally undoable new/add so edit manager.addInitialChar doesnt record the transaction for undoing, where addNewChar does record it for undoing Modified Paths: -------------- phenote/trunk/src/java/phenote/edit/EditManager.java phenote/trunk/src/java/phenote/gui/CharacterTableModel.java phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java Modified: phenote/trunk/src/java/phenote/edit/EditManager.java =================================================================== --- phenote/trunk/src/java/phenote/edit/EditManager.java 2006-11-10 22:06:37 UTC (rev 198) +++ phenote/trunk/src/java/phenote/edit/EditManager.java 2006-11-10 22:54:28 UTC (rev 199) @@ -5,6 +5,7 @@ import org.apache.log4j.Logger; +import phenote.datamodel.Character; import phenote.datamodel.CharacterI; /** The way editing works is gui makes update transaction (see CharFieldGui and @@ -76,6 +77,22 @@ // or should we send out a char change event with a char list?? probably } + /** The initial blank character is a fundamental undoable state, so dont + keep the transaction for this as its not undoable */ + public AddTransaction addInitialCharacter() { + AddTransaction at = new AddTransaction(new Character()); + at.editModel(); + // no addTransaction(at)! + return at; + } + + /** same as addInitialChar except we record the adding in the transaction list + as it can be undone */ + public void addNewCharacter() { + AddTransaction at = addInitialCharacter(); + addTransaction(at); + } + public void copyChars(List<CharacterI> charsToCopy) { if (charsToCopy.isEmpty()) { log().error("No chars to make copy of"); Modified: phenote/trunk/src/java/phenote/gui/CharacterTableModel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-11-10 22:06:37 UTC (rev 198) +++ phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-11-10 22:54:28 UTC (rev 199) @@ -29,7 +29,8 @@ CharacterTableModel() { characterList = getCharListManager().getCharacterList(); - addNewBlankRow(); // add blank row to start off + // should supress editing model for this i think??? + addInitialBlankRow(); // add blank row to start off //getCharListManager().addCharListChangeListener(new TableCharListChangeListener()); // --> panel //EditManager.inst().addCharChangeListener(new TableCharChangeListener()); @@ -67,11 +68,20 @@ boolean hasRows() { return getRowCount() > 0; } + void addInitialBlankRow() { + EditManager.inst().addInitialCharacter(); + fireTableRowsInserted(getRowCount(),getRowCount()); + } + /** Returns row # of new row - handy for selection */ int addNewBlankRow() { - return addCharacter(new Character()); + EditManager.inst().addNewCharacter(); + fireTableRowsInserted(getRowCount(),getRowCount()); + return getRowCount() - 1; // last row + //return addCharacter(new Character()); } + // /** returns row # of new copied into row */ // int copyRow(int rowToCopy) { // if (!hasRows()) @@ -95,22 +105,22 @@ return new RowInterval(rowStart,rowEnd); // fix this - return int[]! } - /** Returns row # of row inserted */ - private int addCharacter(CharacterI character) { - //++rowCount; - // changes data model (fire event?) add transaction for undo! edit man? - characterList.add(character); - fireTableRowsInserted(getRowCount(),getRowCount()); - return getRowCount() -1; - } +// /** Returns row # of row inserted */ +// private int addCharacter(CharacterI character) { +// //++rowCount; +// // changes data model (fire event?) add transaction for undo! edit man? +// characterList.add(character); +// fireTableRowsInserted(getRowCount(),getRowCount()); +// return getRowCount() -1; +// } - void deleteSelectedRow(int deleteRow) { - if (!hasRows()) - return; // err msg? - // This needs to make a delete transaction for undo! edit man? - characterList.remove(deleteRow); - fireTableRowsDeleted(deleteRow,deleteRow); - } +// void deleteSelectedRow(int deleteRow) { +// if (!hasRows()) +// return; // err msg? +// // This needs to make a delete transaction for undo! edit man? +// characterList.remove(deleteRow); +// fireTableRowsDeleted(deleteRow,deleteRow); +// } void deleteChars(List<CharacterI> chars) { if (chars.isEmpty()) { Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-10 22:06:37 UTC (rev 198) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-10 22:54:28 UTC (rev 199) @@ -242,7 +242,8 @@ //fieldPanel.clear(); // SelectionManager.clearCharacterSelection() // adding new row can cause a out of synch selection event - wierd ignoreSelectionChange = true; - selectRow = characterTableModel.addNewBlankRow(); // sr should be 0 + characterTableModel.addInitialBlankRow(); // sr should be 0 + selectRow = 0; ignoreSelectionChange = false; } if (selectRows != null) // multi select This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-10 22:06:39
|
Revision: 198 http://svn.sourceforge.net/obo/?rev=198&view=rev Author: mgibson Date: 2006-11-10 14:06:37 -0800 (Fri, 10 Nov 2006) Log Message: ----------- certain bulk deletes would cause a selection event while view is out of synch with model and exception would fly - now just supress selection event - as proper selection is coming anyways Modified Paths: -------------- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-10 21:48:24 UTC (rev 197) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-10 22:06:37 UTC (rev 198) @@ -52,6 +52,7 @@ private JButton commitButton; private JScrollBar verticalScrollBar; private boolean scrollToNewLastRowOnRepaint = false; + private boolean ignoreSelectionChange = false; //private int selectedRow; // get from file menu? @@ -209,7 +210,11 @@ else if (e.getActionCommand().equals("Delete")) { selectRow = getSelectedRow(); //characterTableModel.deleteSelectedRow(selectRow); + // this will cause a valueChanged() to CharSelListener when things arent in + // synch yet - supress selection listener with flag + ignoreSelectionChange = true; characterTableModel.deleteChars(getSelectedChars()); + ignoreSelectionChange = false; if (selectRow >= charJTable.getRowCount()) selectRow = charJTable.getRowCount()-1; // last row deleted } @@ -235,7 +240,10 @@ // IF DELETED LAST ROW, then need to make a new blank one (sandbox mode) if (!hasRows() && SANDBOX_MODE) { //fieldPanel.clear(); // SelectionManager.clearCharacterSelection() + // adding new row can cause a out of synch selection event - wierd + ignoreSelectionChange = true; selectRow = characterTableModel.addNewBlankRow(); // sr should be 0 + ignoreSelectionChange = false; } if (selectRows != null) // multi select selectRows(selectRows); @@ -253,6 +261,7 @@ notifies selectionManager of new char selection */ private class CharacterSelectionListener implements ListSelectionListener { public void valueChanged(ListSelectionEvent e) { + if (ignoreSelectionChange) return; // for bulk delete error out of synch if (!hasSelection()) // this can happen with a delete row return; // need to track for reinstating select after data change hmm not used anymore?? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-10 21:48:30
|
Revision: 197 http://svn.sourceforge.net/obo/?rev=197&view=rev Author: mgibson Date: 2006-11-10 13:48:24 -0800 (Fri, 10 Nov 2006) Log Message: ----------- preserving order on undo for bulk delete its sorta funny if ya dont Modified Paths: -------------- phenote/trunk/conf/initial-flybase.cfg phenote/trunk/conf/initial-zfin.cfg phenote/trunk/src/java/phenote/datamodel/CharacterList.java phenote/trunk/src/java/phenote/datamodel/CharacterListI.java phenote/trunk/src/java/phenote/edit/CompoundTransaction.java phenote/trunk/src/java/phenote/edit/DeleteTransaction.java Modified: phenote/trunk/conf/initial-flybase.cfg =================================================================== --- phenote/trunk/conf/initial-flybase.cfg 2006-11-10 21:18:30 UTC (rev 196) +++ phenote/trunk/conf/initial-flybase.cfg 2006-11-10 21:48:24 UTC (rev 197) @@ -2,6 +2,7 @@ <phenote-configuration version="0.8" xmlns="phenote/config/xml"> <dataadapter name="phenosyntax"/> + <dataadapter name="phenoxml"/> <log config-file="conf/log4j-standalone.xml" /> Modified: phenote/trunk/conf/initial-zfin.cfg =================================================================== --- phenote/trunk/conf/initial-zfin.cfg 2006-11-10 21:18:30 UTC (rev 196) +++ phenote/trunk/conf/initial-zfin.cfg 2006-11-10 21:48:24 UTC (rev 197) @@ -1,6 +1,7 @@ <phenote-configuration version="0.8" xmlns="phenote/config/xml"> <dataadapter name="phenosyntax"/> + <dataadapter name="phenoxml"/> <log config-file="conf/log4j.xml"/> Modified: phenote/trunk/src/java/phenote/datamodel/CharacterList.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharacterList.java 2006-11-10 21:18:30 UTC (rev 196) +++ phenote/trunk/src/java/phenote/datamodel/CharacterList.java 2006-11-10 21:48:24 UTC (rev 197) @@ -15,9 +15,11 @@ public CharacterI get(int i) { return characterList.get(i); } public void add(CharacterI c) { characterList.add(c); } + public void add(int i, CharacterI c) {characterList.add(i,c); } public void remove(int i) { characterList.remove(i); } public void remove(CharacterI c) { characterList.remove(c); } public int size() { return characterList.size(); } + public int indexOf(CharacterI c) { return characterList.indexOf(c); } public List<CharacterI> getList() { return characterList; } public boolean equals(CharacterListI cl) { Modified: phenote/trunk/src/java/phenote/datamodel/CharacterListI.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharacterListI.java 2006-11-10 21:18:30 UTC (rev 196) +++ phenote/trunk/src/java/phenote/datamodel/CharacterListI.java 2006-11-10 21:48:24 UTC (rev 197) @@ -10,9 +10,11 @@ public CharacterI get(int i); public void add(CharacterI c); + public void add(int order,CharacterI c); public void remove(int i); public void remove(CharacterI c); public int size(); + public int indexOf(CharacterI c); public List<CharacterI> getList(); public boolean equals(CharacterListI cl); /** Sort data by char field enum field */ Modified: phenote/trunk/src/java/phenote/edit/CompoundTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/CompoundTransaction.java 2006-11-10 21:18:30 UTC (rev 196) +++ phenote/trunk/src/java/phenote/edit/CompoundTransaction.java 2006-11-10 21:48:24 UTC (rev 197) @@ -56,8 +56,12 @@ } public void undo() { - for (TransactionI childTrans : childTransactions) - childTrans.undo(); + // actually i think for undo it should be done in reverse - this actually + // matters for delete getting order correct + //for (TransactionI childTrans : childTransactions) + //childTrans.undo(); + for (int i=childTransactions.size()-1; i>=0; i--) + childTransactions.get(i).undo(); } List<TransactionI> getTransactions() { return childTransactions; } Modified: phenote/trunk/src/java/phenote/edit/DeleteTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/DeleteTransaction.java 2006-11-10 21:18:30 UTC (rev 196) +++ phenote/trunk/src/java/phenote/edit/DeleteTransaction.java 2006-11-10 21:48:24 UTC (rev 197) @@ -8,14 +8,20 @@ class DeleteTransaction implements TransactionI { private CharacterI delChar; + // remember where the char was in the list for undo + private int listOrder; DeleteTransaction(CharacterI c) { delChar = c; } public void editModel() { + listOrder = getCharList().indexOf(delChar); getCharList().remove(delChar); } - public void undo() { getCharList().add(delChar); } + // this doesnt put it where it came from on bulk delete as its getting reentered in + // opposite order it got deleted - maybe compound trans should be aware and do kids + // in reverse on undo? - actually thats general + public void undo() { getCharList().add(listOrder,delChar); } public boolean isUpdate() { return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-10 21:18:36
|
Revision: 196 http://svn.sourceforge.net/obo/?rev=196&view=rev Author: mgibson Date: 2006-11-10 13:18:30 -0800 (Fri, 10 Nov 2006) Log Message: ----------- can now undo delete - and do bulk delete added DeleteTransaction on undo doesnt yet remember where the char was and shoves at end - shouldnt be hard to remember and put back where it came from - unintuivie otherwise Modified Paths: -------------- phenote/trunk/src/java/phenote/edit/CompoundTransaction.java phenote/trunk/src/java/phenote/edit/EditManager.java phenote/trunk/src/java/phenote/gui/CharacterTableModel.java phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java Added Paths: ----------- phenote/trunk/src/java/phenote/edit/DeleteTransaction.java Modified: phenote/trunk/src/java/phenote/edit/CompoundTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/CompoundTransaction.java 2006-11-10 16:41:07 UTC (rev 195) +++ phenote/trunk/src/java/phenote/edit/CompoundTransaction.java 2006-11-10 21:18:30 UTC (rev 196) @@ -42,6 +42,13 @@ return copyTrans; } + public static CompoundTransaction makeDelTrans(List<CharacterI> delChars) { + CompoundTransaction delTrans = new CompoundTransaction(); + for (CharacterI c : delChars) + delTrans.addTransaction(new DeleteTransaction(c)); + return delTrans; + } + /** just call editModel on kids */ public void editModel() { for (TransactionI childTrans : childTransactions) Added: phenote/trunk/src/java/phenote/edit/DeleteTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/DeleteTransaction.java (rev 0) +++ phenote/trunk/src/java/phenote/edit/DeleteTransaction.java 2006-11-10 21:18:30 UTC (rev 196) @@ -0,0 +1,30 @@ +package phenote.edit; + +import phenote.datamodel.CharacterI; +import phenote.datamodel.CharacterListI; +import phenote.dataadapter.CharacterListManager; +import phenote.datamodel.CharField; + +class DeleteTransaction implements TransactionI { + + private CharacterI delChar; + + DeleteTransaction(CharacterI c) { delChar = c; } + + public void editModel() { + getCharList().remove(delChar); + } + + public void undo() { getCharList().add(delChar); } + + public boolean isUpdate() { return false; } + + public boolean isUpdateForCharField(CharField c) { return false; } + + // should char list be passed in? charlistMan part of edit pkg? + private CharacterListI getCharList() { + return CharacterListManager.inst().getCharacterList(); + } + + +} Modified: phenote/trunk/src/java/phenote/edit/EditManager.java =================================================================== --- phenote/trunk/src/java/phenote/edit/EditManager.java 2006-11-10 16:41:07 UTC (rev 195) +++ phenote/trunk/src/java/phenote/edit/EditManager.java 2006-11-10 21:18:30 UTC (rev 196) @@ -91,6 +91,16 @@ fireChangeEvent(new CharChangeEvent(this,ct)); } + public void deleteChars(List<CharacterI> delChars) { + if (delChars.isEmpty()) { + log().error("No chars to delete"); + return; + } + CompoundTransaction ct = CompoundTransaction.makeDelTrans(delChars); + ct.editModel(); + addTransaction(ct); + } + private void addTransaction(TransactionI t) { transactionList.add(t); //System.out.println("got trans "+t); Modified: phenote/trunk/src/java/phenote/gui/CharacterTableModel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-11-10 16:41:07 UTC (rev 195) +++ phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-11-10 21:18:30 UTC (rev 196) @@ -112,7 +112,16 @@ fireTableRowsDeleted(deleteRow,deleteRow); } + void deleteChars(List<CharacterI> chars) { + if (chars.isEmpty()) { + log().error("No rows/chars to delete"); + return; + } + EditManager.inst().deleteChars(chars); + fireTableRowsDeleted(0,getRowCount()); // could be more savvy + } + public Object getValueAt(int row, int col) { CharacterI inst = getCharacter(row); if (inst == null) { Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-10 16:41:07 UTC (rev 195) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-10 21:18:30 UTC (rev 196) @@ -195,7 +195,7 @@ scrollToNewLastRowOnRepaint = true;//scrollToLastRow(); // scroll to new row } else if (!hasRows()) { - return; // no rows to copy or delete + return; // its empty! no rows to copy or delete or save or undo } else if (e.getActionCommand().equals("Copy")) { //selectRow = characterTableModel.copyRow(getSelectedRow()); @@ -208,7 +208,8 @@ } else if (e.getActionCommand().equals("Delete")) { selectRow = getSelectedRow(); - characterTableModel.deleteSelectedRow(selectRow); + //characterTableModel.deleteSelectedRow(selectRow); + characterTableModel.deleteChars(getSelectedChars()); if (selectRow >= charJTable.getRowCount()) selectRow = charJTable.getRowCount()-1; // last row deleted } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-10 16:41:17
|
Revision: 195 http://svn.sourceforge.net/obo/?rev=195&view=rev Author: mgibson Date: 2006-11-10 08:41:07 -0800 (Fri, 10 Nov 2006) Log Message: ----------- fix for escaping single quotes in term names in java script functions for webby phenote now done for links in term info as well as onmouseover function getTermInfo in auto comp Modified Paths: -------------- phenote/trunk/src/java/phenote/servlet/PhenoteController.java phenote/trunk/src/java/phenote/util/HtmlUtil.java Modified: phenote/trunk/src/java/phenote/servlet/PhenoteController.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteController.java 2006-11-10 16:13:28 UTC (rev 194) +++ phenote/trunk/src/java/phenote/servlet/PhenoteController.java 2006-11-10 16:41:07 UTC (rev 195) @@ -98,7 +98,7 @@ private String makeCompListHtmlItem(CompletionTerm term, String ontol,String field) { String id = term.getID(); String display = term.getCompListDisplayString(); - String name = escapeSingleQuotes(term.getName()); + String name = term.getName(); // pass in id, name & ontology - name for setting field on UseTerm StringBuffer info = dq(fn("getTermInfo",new String[]{id,name,ontol,field})); StringBuffer select = dq(fn("selectTerm",new String[]{name,field})); @@ -107,10 +107,6 @@ " onclick=" + select + ">" + display + "</li>\n"; } - private String escapeSingleQuotes(String s) { - return s.replace("'","\\'"); - } - private CompListSearcher getCompListSearcher(String ontologyName) throws OntologyException { return new CompListSearcher(getOntology(ontologyName), getSearchParams()); } Modified: phenote/trunk/src/java/phenote/util/HtmlUtil.java =================================================================== --- phenote/trunk/src/java/phenote/util/HtmlUtil.java 2006-11-10 16:13:28 UTC (rev 194) +++ phenote/trunk/src/java/phenote/util/HtmlUtil.java 2006-11-10 16:41:07 UTC (rev 195) @@ -185,8 +185,13 @@ return new StringBuffer("'"+sb+"'"); } private static String q(String s) { + s = escapeSingleQuotes(s); return "'"+s+"'"; } + private static String escapeSingleQuotes(String s) { + if (s == null) return null; // ??? + return s.replace("'","\\'"); + } public static StringBuffer fn(String fnName, String[] params) { StringBuffer s = new StringBuffer(fnName).append("(").append(q(params[0])); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-10 16:13:37
|
Revision: 194 http://svn.sourceforge.net/obo/?rev=194&view=rev Author: mgibson Date: 2006-11-10 08:13:28 -0800 (Fri, 10 Nov 2006) Log Message: ----------- for getTermInfo('termname',...) term names with single quotes in them mess up the java script like Barchet's cleft the ' needs to be escaped \' and now is thanks to kevin for pointing this out Modified Paths: -------------- phenote/trunk/src/java/phenote/servlet/PhenoteController.java Modified: phenote/trunk/src/java/phenote/servlet/PhenoteController.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteController.java 2006-11-10 15:19:55 UTC (rev 193) +++ phenote/trunk/src/java/phenote/servlet/PhenoteController.java 2006-11-10 16:13:28 UTC (rev 194) @@ -96,8 +96,9 @@ } private String makeCompListHtmlItem(CompletionTerm term, String ontol,String field) { - String id = term.getID(), name=term.getName(); + String id = term.getID(); String display = term.getCompListDisplayString(); + String name = escapeSingleQuotes(term.getName()); // pass in id, name & ontology - name for setting field on UseTerm StringBuffer info = dq(fn("getTermInfo",new String[]{id,name,ontol,field})); StringBuffer select = dq(fn("selectTerm",new String[]{name,field})); @@ -106,6 +107,9 @@ " onclick=" + select + ">" + display + "</li>\n"; } + private String escapeSingleQuotes(String s) { + return s.replace("'","\\'"); + } private CompListSearcher getCompListSearcher(String ontologyName) throws OntologyException { return new CompListSearcher(getOntology(ontologyName), getSearchParams()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-10 15:20:12
|
Revision: 193 http://svn.sourceforge.net/obo/?rev=193&view=rev Author: mgibson Date: 2006-11-10 07:19:55 -0800 (Fri, 10 Nov 2006) Log Message: ----------- got the beginnings of undo working!!! woohoo! i was much closer to this than i realized as a lot of groundwork had been laid. char table panel undo button calls EditManager undo. edit man tracks undo - no redo yet - just tossing trans on undo for now free text fields had the misimpression that a select was worthy of editing model and transaction - thats now supressed. undo sends out char change event. char change event has isUpdate & so does TransactionI - for char table panel only need to repaint on update, but havfta redo table on undo of copy (new -> del) selection state aint right after undoing copy (minor) delete & new dont undo yet - no trans for them yet - also no bulk delete yet... also commented out PrefsWindowController import in FileMenu which was causing my commit to fail and compiles to fail and not being used - jim i think this is a class you mustve fiddled with but arent using yet? Modified Paths: -------------- phenote/trunk/src/java/phenote/dataadapter/CharListChangeEvent.java phenote/trunk/src/java/phenote/edit/AddTransaction.java phenote/trunk/src/java/phenote/edit/CharChangeEvent.java phenote/trunk/src/java/phenote/edit/CompoundTransaction.java phenote/trunk/src/java/phenote/edit/EditManager.java phenote/trunk/src/java/phenote/edit/TransactionI.java phenote/trunk/src/java/phenote/edit/UpdateTransaction.java phenote/trunk/src/java/phenote/gui/CharacterTableModel.java phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java phenote/trunk/src/java/phenote/gui/FileMenu.java phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java phenote/trunk/src/java/phenote/main/PhenoteVersion.java Modified: phenote/trunk/src/java/phenote/dataadapter/CharListChangeEvent.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/CharListChangeEvent.java 2006-11-09 19:40:45 UTC (rev 192) +++ phenote/trunk/src/java/phenote/dataadapter/CharListChangeEvent.java 2006-11-10 15:19:55 UTC (rev 193) @@ -3,6 +3,9 @@ import java.util.EventObject; import phenote.datamodel.CharacterListI; +/** this is for dataloading - contains the newly loaded char list - not necasarily + for changes to char list hmm.... */ + public class CharListChangeEvent extends EventObject { private CharacterListI charList; Modified: phenote/trunk/src/java/phenote/edit/AddTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/AddTransaction.java 2006-11-09 19:40:45 UTC (rev 192) +++ phenote/trunk/src/java/phenote/edit/AddTransaction.java 2006-11-10 15:19:55 UTC (rev 193) @@ -16,6 +16,8 @@ addChar = chr; } + public boolean isUpdate() { return false; } + public void editModel() { getCharList().add(addChar); } Modified: phenote/trunk/src/java/phenote/edit/CharChangeEvent.java =================================================================== --- phenote/trunk/src/java/phenote/edit/CharChangeEvent.java 2006-11-09 19:40:45 UTC (rev 192) +++ phenote/trunk/src/java/phenote/edit/CharChangeEvent.java 2006-11-10 15:19:55 UTC (rev 193) @@ -17,14 +17,17 @@ transaction = t; } -// public String getValueString() { // getNewVal, getOldVal??? -// // if undo return ut.getOldValue().getName()??? -// return transaction.getNewValueString(); -// } + public boolean isUpdate() { return transaction.isUpdate(); } + public boolean isUpdateForCharField(CharField cf) { //return transaction.getCharFieldEnum() == cf.getCharFieldEnum(); //if (!transaction.isUpdate()) return false; return transaction.isUpdateForCharField(cf); } +// public String getValueString() { // getNewVal, getOldVal??? +// // if undo return ut.getOldValue().getName()??? +// return transaction.getNewValueString(); +// } + } Modified: phenote/trunk/src/java/phenote/edit/CompoundTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/CompoundTransaction.java 2006-11-09 19:40:45 UTC (rev 192) +++ phenote/trunk/src/java/phenote/edit/CompoundTransaction.java 2006-11-10 15:19:55 UTC (rev 193) @@ -33,6 +33,7 @@ public static CompoundTransaction makeCopyTrans(List<CharacterI> charsToCopy) { CompoundTransaction copyTrans = new CompoundTransaction(); + // error if empty list? for (CharacterI c : charsToCopy) { CharacterI copy = c.cloneCharacter(); AddTransaction at = new AddTransaction(copy); @@ -47,8 +48,20 @@ childTrans.editModel(); } + public void undo() { + for (TransactionI childTrans : childTransactions) + childTrans.undo(); + } + List<TransactionI> getTransactions() { return childTransactions; } + /** returns true if first child is update, assumes kids are homogenous + which currently is a true assumption, change this if that becomes untrue */ + public boolean isUpdate() { + if (!hasTransactions()) return false; + return firstChild().isUpdate(); + } + // /** assumes all transactions have same enum which is true at moment */ // public CharFieldEnum getCharFieldEnum() { // return firstChild().getCharFieldEnum(); @@ -57,8 +70,17 @@ /** queries 1st child for this. assumes all transactions have same charfield/update status which is true at moment (change if need) */ public boolean isUpdateForCharField(CharField cf) { + if (!hasTransactions()) return false; return firstChild().isUpdateForCharField(cf); } - private TransactionI firstChild() { return childTransactions.get(0); } + // should this even be allowed? + private boolean hasTransactions() { + return !childTransactions.isEmpty(); + } + + private TransactionI firstChild() { + if (!hasTransactions()) return null; // ex? + return childTransactions.get(0); + } } Modified: phenote/trunk/src/java/phenote/edit/EditManager.java =================================================================== --- phenote/trunk/src/java/phenote/edit/EditManager.java 2006-11-09 19:40:45 UTC (rev 192) +++ phenote/trunk/src/java/phenote/edit/EditManager.java 2006-11-10 15:19:55 UTC (rev 193) @@ -3,6 +3,8 @@ import java.util.ArrayList; import java.util.List; +import org.apache.log4j.Logger; + import phenote.datamodel.CharacterI; /** The way editing works is gui makes update transaction (see CharFieldGui and @@ -32,8 +34,29 @@ charListeners.add(l); } + public void undo() { + if (!haveUndoableTransaction()) { + log().info("No transactions to undo"); + return; + } + getCurrentTransaction().undo(); + fireChangeEvent(new CharChangeEvent(this,getCurrentTransaction())); + // for now with no redo just toss that last trans + transactionList.remove(getCurrentTransaction()); + } + + private boolean haveUndoableTransaction() { + return !transactionList.isEmpty(); // for now - no redo + } + + private TransactionI getCurrentTransaction() { + // for now just return last one - eventually with redo do some tracking + if (!haveUndoableTransaction()) return null; // ex? + return transactionList.get(transactionList.size()-1); + } + public void updateModel(Object source, UpdateTransaction ut) { - transactionList.add(ut); + addTransaction(ut); updateModelUpdateTrans(source,ut); } @@ -48,23 +71,40 @@ //for (TransactionI t : ct.getTransactions()) //updateModelUpdateTrans(source,t); ct.editModel(); - transactionList.add(ct); + addTransaction(ct); fireChangeEvent(new CharChangeEvent(src,ct)); // or should we send out a char change event with a char list?? probably } public void copyChars(List<CharacterI> charsToCopy) { + if (charsToCopy.isEmpty()) { + log().error("No chars to make copy of"); + return; + } CompoundTransaction ct = CompoundTransaction.makeCopyTrans(charsToCopy); ct.editModel(); // clones & adds char to char list - transactionList.add(ct); + addTransaction(ct); // dont need yet an event for this - might eventually // would this be a char change or charList change or something else? // i think a char list change though thats used for new data load??? + // i think char change is ok?? most listeners just resynch with model ignore evt + fireChangeEvent(new CharChangeEvent(this,ct)); } + private void addTransaction(TransactionI t) { + transactionList.add(t); + //System.out.println("got trans "+t); + } + private void fireChangeEvent(CharChangeEvent e) { for (CharChangeListener l : charListeners) l.charChanged(e); } + private Logger log; + private Logger log() { + if (log == null) log = Logger.getLogger(getClass()); + return log; + } + } Modified: phenote/trunk/src/java/phenote/edit/TransactionI.java =================================================================== --- phenote/trunk/src/java/phenote/edit/TransactionI.java 2006-11-09 19:40:45 UTC (rev 192) +++ phenote/trunk/src/java/phenote/edit/TransactionI.java 2006-11-10 15:19:55 UTC (rev 193) @@ -7,6 +7,10 @@ public void editModel(); + public void undo(); + + public boolean isUpdate(); + ///** this is actually update sepcific - but thats ok i think */ //public CharFieldEnum getCharFieldEnum(); public boolean isUpdateForCharField(CharField cf); Modified: phenote/trunk/src/java/phenote/edit/UpdateTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/UpdateTransaction.java 2006-11-09 19:40:45 UTC (rev 192) +++ phenote/trunk/src/java/phenote/edit/UpdateTransaction.java 2006-11-10 15:19:55 UTC (rev 193) @@ -15,6 +15,8 @@ //private String oldValue; private CharFieldValue newValue; private CharFieldValue oldValue; + // not sure but this may be needed + private boolean isUndone = false; //private boolean undo? public UpdateTransaction(CharacterI c, CharFieldEnum e, String newVal) { @@ -41,6 +43,7 @@ oldValue = e.getValue(c); } + public boolean isUpdate() { return true; } // hmmmmmmm.... // /** if isDifferentia is true than update is for differentia of a post composed term*/ @@ -53,6 +56,7 @@ public void editModel() { newValue.editModel(); + isUndone = false; //charFieldEnum.setValue(character,newValue); } @@ -69,6 +73,14 @@ return newValue.getCharFieldEnum(); } - //public void undo() { oldValue.setValue();//charFieldEnum.setValue(character,oldValue); } + public void undo() { + //oldValue.setValue();//charFieldEnum.setValue(character,oldValue); } + oldValue.editModel(); + isUndone = true; // super.undo()? + } + public boolean isUndone() { return isUndone; } + + // public String getValue() { if isUndone return oldVal else newVal ?? + } Modified: phenote/trunk/src/java/phenote/gui/CharacterTableModel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-11-09 19:40:45 UTC (rev 192) +++ phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-11-10 15:19:55 UTC (rev 193) @@ -5,6 +5,8 @@ import javax.swing.table.AbstractTableModel; +import org.apache.log4j.Logger; + import phenote.datamodel.Character; import phenote.datamodel.CharacterI; import phenote.datamodel.CharacterListI; @@ -80,6 +82,10 @@ /** return int[]? of all new rows to be selected? yes i think so */ RowInterval copyChars(List<CharacterI> charsToCopy) { + if (charsToCopy.isEmpty()) { + log().error("No chars selected to make copy of"); + return new RowInterval(-1,-1); // ex? + } EditManager.inst().copyChars(charsToCopy); // edits model //CompoundTransaction ct = CompoundTransaction.makeCopyTrans(charsToCopy); //ct.editModel(); // clones & adds char to char list @@ -138,6 +144,11 @@ characterList.sortBy(cfe); // ??? fireTableDataChanged(); } + private Logger log; + private Logger log() { + if (log == null) log = Logger.getLogger(getClass()); + return log; + } } Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-09 19:40:45 UTC (rev 192) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-10 15:19:55 UTC (rev 193) @@ -23,6 +23,8 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import org.apache.log4j.Logger; + import phenote.datamodel.CharacterI; import phenote.datamodel.CharacterListI; import phenote.edit.CharChangeEvent; @@ -46,6 +48,7 @@ //private JButton newButton; private JButton copyButton; private JButton deleteButton; + private JButton undoButton; private JButton commitButton; private JScrollBar verticalScrollBar; private boolean scrollToNewLastRowOnRepaint = false; @@ -92,9 +95,11 @@ addButton("New",al,buttonPanel); //newButton = copyButton = addButton("Copy",al,buttonPanel); deleteButton = addButton("Delete",al,buttonPanel); + buttonPanel.add(Box.createRigidArea(new Dimension(20,0))); + undoButton = addButton("Undo",al,buttonPanel); + buttonPanel.add(Box.createRigidArea(new Dimension(80,0))); // should we only add if have data adapter - or disable at least? // should this go in a menu? - buttonPanel.add(Box.createRigidArea(new Dimension(80,0))); commitButton = addButton(SAVE_STRING,al,buttonPanel); add(buttonPanel); @@ -194,6 +199,10 @@ } else if (e.getActionCommand().equals("Copy")) { //selectRow = characterTableModel.copyRow(getSelectedRow()); + if (!hasSelection()) { + log().error("No rows selected for copy - this shouldnt happen!"); + return; + } selectRows = characterTableModel.copyChars(getSelectedChars()); scrollToNewLastRowOnRepaint = true;//scrollToLastRow(); // scroll to new row } @@ -204,6 +213,7 @@ selectRow = charJTable.getRowCount()-1; // last row deleted } + // SAVE else if (e.getActionCommand().equals(SAVE_STRING)) { // commented out this check because it won't work if there are multiple data adapters // error should probably be printed in LoadSaveManager anyway @@ -216,6 +226,11 @@ LoadSaveManager.inst().saveData(); } + // UNDO + else if (e.getActionCommand().equals("Undo")) { + EditManager.inst().undo(); + } + // IF DELETED LAST ROW, then need to make a new blank one (sandbox mode) if (!hasRows() && SANDBOX_MODE) { //fieldPanel.clear(); // SelectionManager.clearCharacterSelection() @@ -258,10 +273,23 @@ independently... */ private class TableCharChangeListener implements CharChangeListener { public void charChanged(CharChangeEvent e) { - //int row = getSelectedRow(); - //fireTableDataChanged(); // ??? causes loss of selection + if (e.isUpdate()) { + repaint(); // repaint causes new cell val to get displayed + return; + } + int row = getSelectedRow(); // multi select?? row del? row add? + // this was commented out repaint was suffic but now needed for undo of copy/delete + // if this is slow we may need to get more savvy - but ill bet its fine + characterTableModel.fireTableDataChanged(); // ??? causes loss of selection //setRowSelectionInterval(row,row); - repaint(); // will this cause new data to display? + // big problem, select row causes char select evt, CFG gets this and tries to + // update itself but causes ex if in middle of edit. need to be more savvy, if + // just char update then need to supress select event as its really just the table + // reinstating its selection actually if update just do repaint and return, + // if add or del then need to + // send out event + selectRow(row); + // repaint(); // is this needed after fireTableDataChanged? } } @@ -313,6 +341,11 @@ void pressCommitButtonTest() { commitButton.doClick(); } + private Logger log; + private Logger log() { + if (log == null) log = Logger.getLogger(getClass()); + return log; + } } // this comes from term panel - replace with MVC stuff.... Modified: phenote/trunk/src/java/phenote/gui/FileMenu.java =================================================================== --- phenote/trunk/src/java/phenote/gui/FileMenu.java 2006-11-09 19:40:45 UTC (rev 192) +++ phenote/trunk/src/java/phenote/gui/FileMenu.java 2006-11-10 15:19:55 UTC (rev 193) @@ -9,7 +9,7 @@ import phenote.dataadapter.DataAdapterI; import phenote.dataadapter.LoadSaveManager; import phenote.config.Config; -import phenote.gui.prefswindow.PrefsWindowController; +//import phenote.gui.prefswindow.PrefsWindowController; class FileMenu extends JMenu { Modified: phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java 2006-11-09 19:40:45 UTC (rev 192) +++ phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java 2006-11-10 15:19:55 UTC (rev 193) @@ -102,13 +102,22 @@ private class FieldCharChangeListener implements CharChangeListener { public void charChanged(CharChangeEvent e) { // check charField is this char field - if (e.getSource() != CharFieldGui.this && e.isUpdateForCharField(charField)) + if (e.getSource() != CharFieldGui.this && e.isUpdateForCharField(charField)) { // i think all we need to do is setText to synch with model // for complist dont we also need to set its model (not just text??) //setText(e.getValueString()); // might as well just synch with model // so in the case of multi select presumably they have all been modified in // the same manner so sufficient to just synch with 1st one + // dont edit model if undo (model already edited!) + // wait any char change event shouldnt change model as it came from model change + //boolean editModel = !e.isUndo(); + //boolean editModel = false; + // maybe setModelUpdateMode(false) ?? + + updateGuiOnly = true; // disable model editing - a better way to do this??? setValueFromChar(getFirstSelectedChar()); + updateGuiOnly = false; // reenable model editing + } } } @@ -147,14 +156,13 @@ /** Set the gui from the model (selection) */ void setValueFromChar(CharacterI character) { if (character == null) { - System.out.println("ERROR: setting to null character"); + log().error("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" - +" not been associated with a datamodel field. check field" - +" names in config "); + log().error("Cant set value for field. Gui for character field has not been "+ + "associated with a datamodel field. check field names in config"); return; } // if its a comp list need to set its model/current term rel (for AACL.setText) @@ -348,7 +356,9 @@ setGuiForMultiSelect(); return; } + updateGuiOnly = true; // selection should not cause an edit! setValueFromChar(e.getChars().get(0)); + updateGuiOnly = false; } } Modified: phenote/trunk/src/java/phenote/main/PhenoteVersion.java =================================================================== --- phenote/trunk/src/java/phenote/main/PhenoteVersion.java 2006-11-09 19:40:45 UTC (rev 192) +++ phenote/trunk/src/java/phenote/main/PhenoteVersion.java 2006-11-10 15:19:55 UTC (rev 193) @@ -6,7 +6,7 @@ //private static final float MAJOR_VERSION_NUM = 0.8f; //private static final float SUB_VERSION_NUM = .3f; - private static final String VERSION = "0.8.3 dev"; // ?? + private static final String VERSION = "0.9.1 dev"; // ?? // type is "dev" or "release" //private static final String type = " dev"; // "release" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2006-11-09 19:41:07
|
Revision: 192 http://svn.sourceforge.net/obo/?rev=192&view=rev Author: balhoff Date: 2006-11-09 11:40:45 -0800 (Thu, 09 Nov 2006) Log Message: ----------- Added support for choosing dataadapter at file load and save. Added LoadSaveManager to centralize file and dataadapter choosing. Implemented filtering of file choose based on file extensions provided by dataadapters. The old file choosing and saving api is still present since it is used by command-line reading and writing. Command-line should be updated to go through the LoadSaveManager. Modified Paths: -------------- phenote/trunk/src/java/phenote/config/Config.java phenote/trunk/src/java/phenote/dataadapter/DataAdapterI.java phenote/trunk/src/java/phenote/dataadapter/fly/FlybaseDataAdapter.java phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java phenote/trunk/src/java/phenote/gui/FileMenu.java Added Paths: ----------- phenote/trunk/src/java/phenote/dataadapter/LoadSaveManager.java Modified: phenote/trunk/src/java/phenote/config/Config.java =================================================================== --- phenote/trunk/src/java/phenote/config/Config.java 2006-11-09 14:54:42 UTC (rev 191) +++ phenote/trunk/src/java/phenote/config/Config.java 2006-11-09 19:40:45 UTC (rev 192) @@ -144,6 +144,10 @@ public boolean hasDataAdapters() { return dataAdapterList != null && !dataAdapterList.isEmpty(); } + + public List<DataAdapterI> getDataAdapters() { + return new ArrayList(dataAdapterList); + } /** Return true if have a dataadapter, and only 1 data adapter */ public boolean hasSingleDataAdapter() { Modified: phenote/trunk/src/java/phenote/dataadapter/DataAdapterI.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/DataAdapterI.java 2006-11-09 14:54:42 UTC (rev 191) +++ phenote/trunk/src/java/phenote/dataadapter/DataAdapterI.java 2006-11-09 19:40:45 UTC (rev 192) @@ -1,14 +1,19 @@ package phenote.dataadapter; -//import java.util.List; +import java.util.List; +import java.io.File; import phenote.datamodel.CharacterListI; + public interface DataAdapterI { + // it is weird that these have different return values, but load() should go away in the near future public void load(); + public CharacterListI load(File f); public void commit(CharacterListI charList); + public void commit(CharacterListI charList, File f); /** Set value to use for loading or writeback, for a file adapter this would be the file name - is there a better name for this method? @@ -16,5 +21,8 @@ AdapterValue/DataInput object if this gets more involved - but that may not be necasary - certianly string ok for now */ public void setAdapterValue(String adapterValue); + + public List<String> getExtensions(); + public String getDescription(); } Added: phenote/trunk/src/java/phenote/dataadapter/LoadSaveManager.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/LoadSaveManager.java (rev 0) +++ phenote/trunk/src/java/phenote/dataadapter/LoadSaveManager.java 2006-11-09 19:40:45 UTC (rev 192) @@ -0,0 +1,158 @@ +package phenote.dataadapter; + +import java.io.File; +import java.util.List; +import java.lang.ClassNotFoundException; +import javax.swing.JFileChooser; +import javax.swing.filechooser.FileFilter; + +import phenote.dataadapter.DataAdapterI; +import phenote.dataadapter.CharacterListManager; +import phenote.datamodel.CharacterListI; +import phenote.config.Config; + + +public class LoadSaveManager { + + private static LoadSaveManager singleton; + private JFileChooser fileChooser; + + private LoadSaveManager() { + fileChooser = new JFileChooser(); + List<DataAdapterI> adapters = Config.inst().getDataAdapters(); + for (DataAdapterI adapter: adapters) { + DataAdapterFileFilter filter = new DataAdapterFileFilter(adapter); + fileChooser.addChoosableFileFilter(filter); + } + } + + /**Returns singleton*/ + public static LoadSaveManager inst() { + if (singleton == null) + singleton = new LoadSaveManager(); + return singleton; + } + + /**Loads a new document of characters, prompting the user to choose a file and possibly a data adapter.*/ + public void loadData() { + File aFile = runOpenDialog(); + if (aFile != null) { + FileFilter filter = fileChooser.getFileFilter(); + if (filter instanceof DataAdapterFileFilter) { + DataAdapterI adapter = ((DataAdapterFileFilter)filter).getAdapter(); + loadData(aFile, adapter); + } else { + loadData(aFile); + } + } + } + + /**Loads a new document of characters from the given file, using the default data adapter for the file's extension.*/ + public void loadData(File f) { + DataAdapterI adapter = getDataAdapterForFilename(f.getName()); + loadData(f, adapter); + } + + /**Loads a new document of characters from the given file using the given data adapter.*/ + public void loadData(File f, DataAdapterI adapter) { + CharacterListI charList = adapter.load(f); + CharacterListManager.inst().setCharacterList(this,charList); + } + + /**Saves the document's characters to a file, prompting the user to choose a file and data adapter.*/ + public void saveData() { + File aFile = runSaveDialog(); + if (aFile != null) { + FileFilter filter = fileChooser.getFileFilter(); + if (filter instanceof DataAdapterFileFilter) { + DataAdapterI adapter = ((DataAdapterFileFilter)filter).getAdapter(); + saveData(aFile, adapter); + } else { + saveData(aFile); + } + } + } + + /**Saves the document's characters to the given file, using the default data adapter for the file's extension.*/ + public void saveData(File f) { + DataAdapterI adapter = getDataAdapterForFilename(f.getName()); + saveData(f, adapter); + } + + /**Saves the document's characters to the given file using the given data adapter.*/ + public void saveData(File f, DataAdapterI adapter) { + CharacterListI charList = CharacterListManager.inst().getCharacterList(); + adapter.commit(charList, f); + } + + private File runOpenDialog() { + fileChooser.setAcceptAllFileFilterUsed(true); + int returnValue = fileChooser.showOpenDialog(null); + if (returnValue == JFileChooser.APPROVE_OPTION) { + return fileChooser.getSelectedFile(); + } else { + return null; + } + } + + private File runSaveDialog() { + fileChooser.setAcceptAllFileFilterUsed(false); + int returnValue = fileChooser.showSaveDialog(null); + if (returnValue == JFileChooser.APPROVE_OPTION) { + return fileChooser.getSelectedFile(); + } else { + return null; + } + } + + private DataAdapterI getDataAdapterForFilename(String filename) { + List<DataAdapterI> adapters = Config.inst().getDataAdapters(); + for (DataAdapterI adapter: adapters) { + List<String> extensions = adapter.getExtensions(); + for (String extension: extensions) { + if (filename.endsWith("." + extension)) { + return adapter; + } + } + } + // just try first adapter if none match extension + return Config.inst().getSingleDataAdapter(); + } + + + private class DataAdapterFileFilter extends FileFilter { + + private DataAdapterI dataAdapter; + + DataAdapterFileFilter(DataAdapterI adapter) { + super(); + dataAdapter = adapter; + } + + public boolean accept(File f) { + if (f.isDirectory()) { + return true; + } + boolean matches = false; + List<String> extensions = getExtensions(); + for (String extension: extensions) { + matches = (f.getName().endsWith("." + extension)); + if (matches) break; + } + return matches; + } + + public String getDescription() { + return dataAdapter.getDescription(); + } + + public List<String> getExtensions() { + return dataAdapter.getExtensions(); + } + + public DataAdapterI getAdapter() { + return dataAdapter; + } + } + +} Modified: phenote/trunk/src/java/phenote/dataadapter/fly/FlybaseDataAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/fly/FlybaseDataAdapter.java 2006-11-09 14:54:42 UTC (rev 191) +++ phenote/trunk/src/java/phenote/dataadapter/fly/FlybaseDataAdapter.java 2006-11-09 19:40:45 UTC (rev 192) @@ -6,6 +6,7 @@ import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.Toolkit; +import java.io.File; import phenote.datamodel.CharacterI; import phenote.datamodel.CharacterListI; @@ -37,6 +38,16 @@ getClipboard().setContents(tr,clipboardOwner); } + + public void commit(CharacterListI charList, File f) { + commit(charList); + } + + public CharacterListI load(File f) { + // this is pretty much a dummy implementation + load(); + return null; + } /** load character set from clipboard if there is one */ public void load() { @@ -73,7 +84,16 @@ public static ClipboardOwner getClipboardOwner() { return clipboardOwner; } + + public List<String> getExtensions() { + return null; + } + + public String getDescription() { + return "FlyBase adapter"; + } + private static class PhenoteClipboardOwner implements ClipboardOwner { public void lostOwnership(Clipboard clipboard, Transferable contents) { // ownership has changed - should check if proforma has plopped something... Modified: phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java 2006-11-09 14:54:42 UTC (rev 191) +++ phenote/trunk/src/java/phenote/dataadapter/phenosyntax/PhenoSyntaxFileAdapter.java 2006-11-09 19:40:45 UTC (rev 192) @@ -7,6 +7,8 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.LineNumberReader; +import java.util.List; +import java.util.Arrays; import phenote.datamodel.CharacterI; import phenote.datamodel.CharacterListI; @@ -24,6 +26,7 @@ private File previousFile; private File file; + private static String[] extensions = {"psx", "syn"}; /** command line setting of file */ public void setAdapterValue(String filename) { @@ -38,7 +41,6 @@ file = getFileFromUserForOpen(previousFile); if (file == null) return; previousFile = file; - try { CharacterListI charList = new CharacterList(); LineNumberReader lnr = new LineNumberReader(new FileReader(file)); @@ -60,6 +62,29 @@ } file = null; // null it for next load/commit } + + public CharacterListI load(File f) { + // this method temporarily duplicates code from load() - soon load() will be removed + CharacterListI charList = new CharacterList(); + try { + LineNumberReader lnr = new LineNumberReader(new FileReader(f)); + 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 + } + } + lnr.close(); + } + catch (IOException e) { + System.out.println("PhenoSyntax read failure "+e); + } + return charList; + } /** returns null if user fails to pick a file */ // private File getFileFromUser(File dir) { @@ -104,5 +129,18 @@ pw.close(); file = null; } + + public void commit(CharacterListI charList, File f) { + file = f; + commit(charList); + } + + public List<String> getExtensions() { + return Arrays.asList(extensions); + } + + public String getDescription() { + return "PhenoSyntax files"; + } } Modified: phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java 2006-11-09 14:54:42 UTC (rev 191) +++ phenote/trunk/src/java/phenote/dataadapter/phenoxml/PhenoXmlAdapter.java 2006-11-09 19:40:45 UTC (rev 192) @@ -5,6 +5,7 @@ import java.util.HashSet; import java.util.Set; import java.util.List; +import java.util.Arrays; import javax.swing.JFileChooser; @@ -33,17 +34,38 @@ import phenote.dataadapter.CharacterListManager; import phenote.dataadapter.DataAdapterI; +import javax.swing.JComboBox; +import javax.swing.filechooser.FileFilter; + + public class PhenoXmlAdapter implements DataAdapterI { private Set<String> genotypesAlreadyAdded = new HashSet<String>(); private File previousFile; private File file; + private static String[] extensions = {"pxml", "xml"}; /** command line setting of file */ public void setAdapterValue(String filename) { file = new File(filename); } + + public CharacterListI load(File f) { + // this method temporarily duplicates code from load(), which will soon be removed + CharacterListI charList = new CharacterList(); // we will return this empty one if we fail reading the xml + try { + PhenosetDocument doc = PhenosetDocument.Factory.parse(f); + charList = newCharacterListFromPhenosetDocument(doc); + } + catch (XmlException e) { + System.out.println("Failed to load file as phenoxml " + e); + } + catch (IOException e) { + System.out.println("PhenoXml read failure " + e); + } + return charList; + } public void load() { try { @@ -182,10 +204,25 @@ System.out.println("Failed to save "+e); } } + + public void commit(CharacterListI charList, File f) { + file = f; + commit(charList); + } public static File getFileFromUserIsSave(File dir, boolean isSave) { // todo - remember last accessed dir JFileChooser fileChooser = new JFileChooser(dir); + + //String[] dataAdapterNames = {"PhenoSyntax", "PhenoXML"}; + //JComboBox comboBox = new JComboBox(dataAdapterNames); + //fileChooser.setAccessory(comboBox); + //FileFilter phenoXMLFilter = new FileNameExtensionFilter("PhenoXML file", "pxml"); + //FileFilter phenoSyntaxFilter = new FileNameExtensionFilter("PhenoSyntax file", "psx", "syn"); + //fileChooser.addChoosableFileFilter(phenoXMLFilter); + //fileChooser.addChoosableFileFilter(phenoSyntaxFilter); + + // todo - file filter - only .xml or .phenoxml? int returnVal; if (isSave) { @@ -273,4 +310,14 @@ Provenance provenance = pm.addNewProvenance(); provenance.setId(chr.getPub()); } + + public List<String> getExtensions() { + return Arrays.asList(extensions); + } + + public String getDescription() { + return "PhenoXML files"; + } + + } Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-09 14:54:42 UTC (rev 191) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-09 19:40:45 UTC (rev 192) @@ -33,6 +33,7 @@ import phenote.dataadapter.CharacterListManager; import phenote.config.Config; import phenote.gui.selection.SelectionManager; +import phenote.dataadapter.LoadSaveManager; /** Character panel has character table and del add copy buttons to manipulate * table. Modifications to fields modify columns in selected row in table @@ -204,12 +205,15 @@ } else if (e.getActionCommand().equals(SAVE_STRING)) { - Config c = Config.inst(); - if (!c.hasSingleDataAdapter()) { - System.out.println("Cant commit. No data adapter configged"); - return; - } - c.getSingleDataAdapter().commit(characterTableModel.getCharacterList()); + // commented out this check because it won't work if there are multiple data adapters + // error should probably be printed in LoadSaveManager anyway + //Config c = Config.inst(); + //if (!c.hasSingleDataAdapter()) { + // System.out.println("Cant commit. No data adapter configged"); + // return; + //} + //c.getSingleDataAdapter().commit(characterTableModel.getCharacterList()); + LoadSaveManager.inst().saveData(); } // IF DELETED LAST ROW, then need to make a new blank one (sandbox mode) Modified: phenote/trunk/src/java/phenote/gui/FileMenu.java =================================================================== --- phenote/trunk/src/java/phenote/gui/FileMenu.java 2006-11-09 14:54:42 UTC (rev 191) +++ phenote/trunk/src/java/phenote/gui/FileMenu.java 2006-11-09 19:40:45 UTC (rev 192) @@ -7,7 +7,9 @@ import phenote.dataadapter.CharacterListManager; import phenote.dataadapter.DataAdapterI; +import phenote.dataadapter.LoadSaveManager; import phenote.config.Config; +import phenote.gui.prefswindow.PrefsWindowController; class FileMenu extends JMenu { @@ -32,7 +34,6 @@ save.setActionCommand("save"); save.addActionListener(actionListener); add(save); - } private class LoadSaveActionListener implements ActionListener { @@ -42,17 +43,13 @@ return; } if (e.getActionCommand().equals("load")) - getDataAdapter().load(); + LoadSaveManager.inst().loadData(); else if (e.getActionCommand().equals("save")) - getDataAdapter().commit(CharacterListManager.inst().getCharacterList()); + LoadSaveManager.inst().saveData(); } } - private DataAdapterI getDataAdapter() { - return Config.inst().getSingleDataAdapter(); - } - // for testing public void clickLoad() { loadMenuItem.doClick(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-09 14:54:51
|
Revision: 191 http://svn.sourceforge.net/obo/?rev=191&view=rev Author: mgibson Date: 2006-11-09 06:54:42 -0800 (Thu, 09 Nov 2006) Log Message: ----------- char table model copy calls edit manager that makes trans and records trans - proper way to do it - for undo really Modified Paths: -------------- phenote/trunk/src/java/phenote/edit/EditManager.java phenote/trunk/src/java/phenote/gui/CharacterTableModel.java Modified: phenote/trunk/src/java/phenote/edit/EditManager.java =================================================================== --- phenote/trunk/src/java/phenote/edit/EditManager.java 2006-11-08 21:04:05 UTC (rev 190) +++ phenote/trunk/src/java/phenote/edit/EditManager.java 2006-11-09 14:54:42 UTC (rev 191) @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.List; +import phenote.datamodel.CharacterI; /** The way editing works is gui makes update transaction (see CharFieldGui and AutoComboBox) and calls @@ -44,14 +45,23 @@ } public void updateModel(Object src, CompoundTransaction ct) { - transactionList.add(ct); //for (TransactionI t : ct.getTransactions()) //updateModelUpdateTrans(source,t); ct.editModel(); + transactionList.add(ct); fireChangeEvent(new CharChangeEvent(src,ct)); // or should we send out a char change event with a char list?? probably } + public void copyChars(List<CharacterI> charsToCopy) { + CompoundTransaction ct = CompoundTransaction.makeCopyTrans(charsToCopy); + ct.editModel(); // clones & adds char to char list + transactionList.add(ct); + // dont need yet an event for this - might eventually + // would this be a char change or charList change or something else? + // i think a char list change though thats used for new data load??? + } + private void fireChangeEvent(CharChangeEvent e) { for (CharChangeListener l : charListeners) l.charChanged(e); Modified: phenote/trunk/src/java/phenote/gui/CharacterTableModel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-11-08 21:04:05 UTC (rev 190) +++ phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-11-09 14:54:42 UTC (rev 191) @@ -9,7 +9,8 @@ import phenote.datamodel.CharacterI; import phenote.datamodel.CharacterListI; import phenote.datamodel.CharFieldEnum; -import phenote.edit.CompoundTransaction; +//import phenote.edit.CompoundTransaction; +import phenote.edit.EditManager; import phenote.dataadapter.CharacterListManager; import phenote.config.Config; @@ -79,8 +80,9 @@ /** return int[]? of all new rows to be selected? yes i think so */ RowInterval copyChars(List<CharacterI> charsToCopy) { - CompoundTransaction ct = CompoundTransaction.makeCopyTrans(charsToCopy); - ct.editModel(); // clones & adds char to char list + EditManager.inst().copyChars(charsToCopy); // edits model + //CompoundTransaction ct = CompoundTransaction.makeCopyTrans(charsToCopy); + //ct.editModel(); // clones & adds char to char list fireTableRowsInserted(getRowCount(),getRowCount()); // updates table view int rowEnd = getRowCount() - 1; // -1 -> 0 based int rowStart = rowEnd - charsToCopy.size() + 1; // +1 inclusive This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-08 21:21:17
|
Revision: 190 http://svn.sourceforge.net/obo/?rev=190&view=rev Author: mgibson Date: 2006-11-08 13:04:05 -0800 (Wed, 08 Nov 2006) Log Message: ----------- bulk copy is working! CompoundTransaction has .makeCopyTrans that makes a bunch of new AddTransactions as children from char list passed in that it clones - editModel on AddTransaction adds char to char list woops i realize i didnt send it to editManager - not needed now - but for undo editManager needs for tracking edits. CharTablePanel selects rows that have been copied to Modified Paths: -------------- phenote/trunk/src/java/phenote/dataadapter/CharacterListManager.java phenote/trunk/src/java/phenote/datamodel/CharacterList.java phenote/trunk/src/java/phenote/datamodel/CharacterListI.java phenote/trunk/src/java/phenote/datamodel/Ontology.java phenote/trunk/src/java/phenote/edit/CharChangeEvent.java phenote/trunk/src/java/phenote/edit/CompoundTransaction.java phenote/trunk/src/java/phenote/edit/EditManager.java phenote/trunk/src/java/phenote/edit/TransactionI.java phenote/trunk/src/java/phenote/edit/UpdateTransaction.java phenote/trunk/src/java/phenote/gui/CharacterTableModel.java phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java Added Paths: ----------- phenote/trunk/src/java/phenote/edit/AddTransaction.java Modified: phenote/trunk/src/java/phenote/dataadapter/CharacterListManager.java =================================================================== --- phenote/trunk/src/java/phenote/dataadapter/CharacterListManager.java 2006-11-07 22:48:39 UTC (rev 189) +++ phenote/trunk/src/java/phenote/dataadapter/CharacterListManager.java 2006-11-08 21:04:05 UTC (rev 190) @@ -1,5 +1,6 @@ package phenote.dataadapter; // I think this makes more sense in dataadapter than datamodel ? +// actually should go in edit package maybe? import java.util.ArrayList; import java.util.List; Modified: phenote/trunk/src/java/phenote/datamodel/CharacterList.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharacterList.java 2006-11-07 22:48:39 UTC (rev 189) +++ phenote/trunk/src/java/phenote/datamodel/CharacterList.java 2006-11-08 21:04:05 UTC (rev 190) @@ -16,6 +16,7 @@ public CharacterI get(int i) { return characterList.get(i); } public void add(CharacterI c) { characterList.add(c); } public void remove(int i) { characterList.remove(i); } + public void remove(CharacterI c) { characterList.remove(c); } public int size() { return characterList.size(); } public List<CharacterI> getList() { return characterList; } Modified: phenote/trunk/src/java/phenote/datamodel/CharacterListI.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharacterListI.java 2006-11-07 22:48:39 UTC (rev 189) +++ phenote/trunk/src/java/phenote/datamodel/CharacterListI.java 2006-11-08 21:04:05 UTC (rev 190) @@ -11,6 +11,7 @@ public CharacterI get(int i); public void add(CharacterI c); public void remove(int i); + public void remove(CharacterI c); public int size(); public List<CharacterI> getList(); public boolean equals(CharacterListI cl); Modified: phenote/trunk/src/java/phenote/datamodel/Ontology.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/Ontology.java 2006-11-07 22:48:39 UTC (rev 189) +++ phenote/trunk/src/java/phenote/datamodel/Ontology.java 2006-11-08 21:04:05 UTC (rev 190) @@ -55,7 +55,7 @@ public String getVersion() { // this is wrong - this just says file name loaded from. obo file puts version in // remark field but doesnt seem to be way to get that from obo session?? - return oboSession.getLoadRemark(); + return oboSession.getCurrentHistory().getVersion(); } private void makeSortedLists(OBOSession oboSession) { Added: phenote/trunk/src/java/phenote/edit/AddTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/AddTransaction.java (rev 0) +++ phenote/trunk/src/java/phenote/edit/AddTransaction.java 2006-11-08 21:04:05 UTC (rev 190) @@ -0,0 +1,33 @@ +package phenote.edit; + +import phenote.datamodel.CharacterI; +import phenote.datamodel.CharacterListI; +// does char list manager belong in edit package? +import phenote.dataadapter.CharacterListManager; +import phenote.datamodel.CharField; + +/** For adding a character (not a char subpart - thats an update) */ + +public class AddTransaction implements TransactionI { + + private CharacterI addChar; + + public AddTransaction(CharacterI chr) { + addChar = chr; + } + + public void editModel() { + getCharList().add(addChar); + } + + public void undo() { getCharList().remove(addChar); } + + // should char list be passed in? charlistMan part of edit pkg? + private CharacterListI getCharList() { + return CharacterListManager.inst().getCharacterList(); + } + + /** this is for update trans - return false */ + public boolean isUpdateForCharField(CharField cf) { return false; } + +} Modified: phenote/trunk/src/java/phenote/edit/CharChangeEvent.java =================================================================== --- phenote/trunk/src/java/phenote/edit/CharChangeEvent.java 2006-11-07 22:48:39 UTC (rev 189) +++ phenote/trunk/src/java/phenote/edit/CharChangeEvent.java 2006-11-08 21:04:05 UTC (rev 190) @@ -7,21 +7,24 @@ /** This actually is for a CharField change - rename this CharFieldChangeEvent? */ public class CharChangeEvent extends EventObject { - // UpdateTrans -> Transaction? - private UpdateTransaction transaction; + // UpdateTrans -> Transaction? yes! + //private UpdateTransaction transaction; + private TransactionI transaction; // boolean undo??? or in trans? of just editManager? - CharChangeEvent(Object source, UpdateTransaction ut) { + CharChangeEvent(Object source, TransactionI t) { super(source); - transaction = ut; + transaction = t; } - public String getValueString() { // getNewVal, getOldVal??? - // if undo return ut.getOldValue().getName()??? - return transaction.getNewValueString(); - } +// public String getValueString() { // getNewVal, getOldVal??? +// // if undo return ut.getOldValue().getName()??? +// return transaction.getNewValueString(); +// } - public boolean isForCharField(CharField cf) { - return transaction.getCharFieldEnum() == cf.getCharFieldEnum(); + public boolean isUpdateForCharField(CharField cf) { + //return transaction.getCharFieldEnum() == cf.getCharFieldEnum(); + //if (!transaction.isUpdate()) return false; + return transaction.isUpdateForCharField(cf); } } Modified: phenote/trunk/src/java/phenote/edit/CompoundTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/CompoundTransaction.java 2006-11-07 22:48:39 UTC (rev 189) +++ phenote/trunk/src/java/phenote/edit/CompoundTransaction.java 2006-11-08 21:04:05 UTC (rev 190) @@ -5,22 +5,60 @@ import org.geneontology.oboedit.datamodel.OBOClass; +import phenote.datamodel.CharField; import phenote.datamodel.CharFieldEnum; import phenote.datamodel.CharacterI; public class CompoundTransaction implements TransactionI { // for now we just have UpdateTransactions - later will have Add & Del trans - List<UpdateTransaction> childTransactions = new ArrayList<UpdateTransaction>(); + List<TransactionI> childTransactions = new ArrayList<TransactionI>(); + /** for bulk updates of string/free text */ public CompoundTransaction(List<CharacterI>chars,CharFieldEnum e, String newVal) { for (CharacterI ch : chars) childTransactions.add(new UpdateTransaction(ch,e,newVal)); } + /** bulk updates of terms */ public CompoundTransaction(List<CharacterI>chars,CharFieldEnum e, OBOClass newVal) { for (CharacterI ch : chars) childTransactions.add(new UpdateTransaction(ch,e,newVal)); } - List<UpdateTransaction> getTransactions() { return childTransactions; } + private CompoundTransaction() {} + + private void addTransaction(TransactionI trans) { + childTransactions.add(trans); + } + + public static CompoundTransaction makeCopyTrans(List<CharacterI> charsToCopy) { + CompoundTransaction copyTrans = new CompoundTransaction(); + for (CharacterI c : charsToCopy) { + CharacterI copy = c.cloneCharacter(); + AddTransaction at = new AddTransaction(copy); + copyTrans.addTransaction(at); + } + return copyTrans; + } + + /** just call editModel on kids */ + public void editModel() { + for (TransactionI childTrans : childTransactions) + childTrans.editModel(); + } + + List<TransactionI> getTransactions() { return childTransactions; } + +// /** assumes all transactions have same enum which is true at moment */ +// public CharFieldEnum getCharFieldEnum() { +// return firstChild().getCharFieldEnum(); +// } + + /** queries 1st child for this. assumes all transactions have same charfield/update + status which is true at moment (change if need) */ + public boolean isUpdateForCharField(CharField cf) { + return firstChild().isUpdateForCharField(cf); + } + + private TransactionI firstChild() { return childTransactions.get(0); } } Modified: phenote/trunk/src/java/phenote/edit/EditManager.java =================================================================== --- phenote/trunk/src/java/phenote/edit/EditManager.java 2006-11-07 22:48:39 UTC (rev 189) +++ phenote/trunk/src/java/phenote/edit/EditManager.java 2006-11-08 21:04:05 UTC (rev 190) @@ -40,15 +40,21 @@ private void updateModelUpdateTrans(Object src, UpdateTransaction ut) { ut.editModel(); CharChangeEvent e = new CharChangeEvent(src,ut); - for (CharChangeListener l : charListeners) - l.charChanged(e); + fireChangeEvent(e); } - public void updateModel(Object source, CompoundTransaction ct) { + public void updateModel(Object src, CompoundTransaction ct) { transactionList.add(ct); - for (UpdateTransaction ut : ct.getTransactions()) - updateModelUpdateTrans(source,ut); + //for (TransactionI t : ct.getTransactions()) + //updateModelUpdateTrans(source,t); + ct.editModel(); + fireChangeEvent(new CharChangeEvent(src,ct)); // or should we send out a char change event with a char list?? probably } + private void fireChangeEvent(CharChangeEvent e) { + for (CharChangeListener l : charListeners) + l.charChanged(e); + } + } Modified: phenote/trunk/src/java/phenote/edit/TransactionI.java =================================================================== --- phenote/trunk/src/java/phenote/edit/TransactionI.java 2006-11-07 22:48:39 UTC (rev 189) +++ phenote/trunk/src/java/phenote/edit/TransactionI.java 2006-11-08 21:04:05 UTC (rev 190) @@ -1,7 +1,14 @@ package phenote.edit; +import phenote.datamodel.CharField; // interface? class? public interface TransactionI { + public void editModel(); + + ///** this is actually update sepcific - but thats ok i think */ + //public CharFieldEnum getCharFieldEnum(); + public boolean isUpdateForCharField(CharField cf); + //public String getValueString(); } Modified: phenote/trunk/src/java/phenote/edit/UpdateTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/UpdateTransaction.java 2006-11-07 22:48:39 UTC (rev 189) +++ phenote/trunk/src/java/phenote/edit/UpdateTransaction.java 2006-11-08 21:04:05 UTC (rev 190) @@ -2,6 +2,7 @@ import org.geneontology.oboedit.datamodel.OBOClass; +import phenote.datamodel.CharField; import phenote.datamodel.CharFieldEnum; import phenote.datamodel.CharFieldValue; import phenote.datamodel.CharacterI; @@ -60,7 +61,11 @@ String getNewValueString() { return newValue.getName(); } - CharFieldEnum getCharFieldEnum() { + public boolean isUpdateForCharField(CharField cf) { + return getCharFieldEnum() == cf.getCharFieldEnum(); + } + + private CharFieldEnum getCharFieldEnum() { return newValue.getCharFieldEnum(); } Modified: phenote/trunk/src/java/phenote/gui/CharacterTableModel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-11-07 22:48:39 UTC (rev 189) +++ phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-11-08 21:04:05 UTC (rev 190) @@ -9,6 +9,7 @@ import phenote.datamodel.CharacterI; import phenote.datamodel.CharacterListI; import phenote.datamodel.CharFieldEnum; +import phenote.edit.CompoundTransaction; import phenote.dataadapter.CharacterListManager; import phenote.config.Config; @@ -68,14 +69,24 @@ return addCharacter(new Character()); } - /** returns row # of new copied into row */ - int copyRow(int rowToCopy) { - if (!hasRows()) - return -1; // err msg? - CharacterI copy = getCharacter(rowToCopy).cloneCharacter(); - return addCharacter(copy); +// /** returns row # of new copied into row */ +// int copyRow(int rowToCopy) { +// if (!hasRows()) +// return -1; // err msg? +// CharacterI copy = getCharacter(rowToCopy).cloneCharacter(); +// return addCharacter(copy); +// } + + /** return int[]? of all new rows to be selected? yes i think so */ + RowInterval copyChars(List<CharacterI> charsToCopy) { + CompoundTransaction ct = CompoundTransaction.makeCopyTrans(charsToCopy); + ct.editModel(); // clones & adds char to char list + fireTableRowsInserted(getRowCount(),getRowCount()); // updates table view + int rowEnd = getRowCount() - 1; // -1 -> 0 based + int rowStart = rowEnd - charsToCopy.size() + 1; // +1 inclusive + return new RowInterval(rowStart,rowEnd); // fix this - return int[]! } - + /** Returns row # of row inserted */ private int addCharacter(CharacterI character) { //++rowCount; @@ -127,6 +138,13 @@ } } + +class RowInterval { + RowInterval(int start,int end) { startRow = start; endRow = end; } + int startRow; + int endRow; +} + //--rowCount; // hmmmmm - this cant be hardwired, needs to work with config // not sure how to do this.... Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-07 22:48:39 UTC (rev 189) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-08 21:04:05 UTC (rev 190) @@ -130,6 +130,18 @@ charJTable.setRowSelectionInterval(row,row); } + private void selectRows(RowInterval selRows) { + int start = selRows.startRow, end = selRows.endRow; + if (charJTable != null && start >= 0 && end < charJTable.getRowCount()) + charJTable.setRowSelectionInterval(start,end); + } + +// private void selectRows(int start, int end) { +// if (charJTable != null && start >= 0 && end < charJTable.getRowCount()) +// charJTable.setRowSelectionInterval(start,end); +// System.out.println("sel start "+start+" end "+end+" ? "+(charJTable != null && start >= 0 && end < charJTable.getRowCount())); +// } + // used internally and by test phenote - should use sel man? CharacterI getSelectedCharacter() { return characterTableModel.getCharacter(getSelectedRow()); @@ -171,6 +183,7 @@ // bug/issue - if last row is deleted should create new blank one... public void actionPerformed(ActionEvent e) { int selectRow = 0; + RowInterval selectRows=null; if (e.getActionCommand().equals("New")) { selectRow = characterTableModel.addNewBlankRow(); scrollToNewLastRowOnRepaint = true;//scrollToLastRow(); // scroll to new row @@ -179,7 +192,8 @@ return; // no rows to copy or delete } else if (e.getActionCommand().equals("Copy")) { - selectRow = characterTableModel.copyRow(getSelectedRow()); + //selectRow = characterTableModel.copyRow(getSelectedRow()); + selectRows = characterTableModel.copyChars(getSelectedChars()); scrollToNewLastRowOnRepaint = true;//scrollToLastRow(); // scroll to new row } else if (e.getActionCommand().equals("Delete")) { @@ -203,7 +217,10 @@ //fieldPanel.clear(); // SelectionManager.clearCharacterSelection() selectRow = characterTableModel.addNewBlankRow(); // sr should be 0 } - selectRow(selectRow); + if (selectRows != null) // multi select + selectRows(selectRows); + else // single row select + selectRow(selectRow); repaint(); // check whether enable/disable del & copy buttons - disable w no rows // doesnt happen in sandbox actually - or shouldnt Modified: phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java 2006-11-07 22:48:39 UTC (rev 189) +++ phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java 2006-11-08 21:04:05 UTC (rev 190) @@ -102,7 +102,7 @@ private class FieldCharChangeListener implements CharChangeListener { public void charChanged(CharChangeEvent e) { // check charField is this char field - if (e.getSource() != CharFieldGui.this && e.isForCharField(charField)) + if (e.getSource() != CharFieldGui.this && e.isUpdateForCharField(charField)) // i think all we need to do is setText to synch with model // for complist dont we also need to set its model (not just text??) //setText(e.getValueString()); // might as well just synch with model This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2006-11-07 22:48:43
|
Revision: 189 http://svn.sourceforge.net/obo/?rev=189&view=rev Author: cmpich Date: 2006-11-07 14:48:39 -0800 (Tue, 07 Nov 2006) Log Message: ----------- added version number through PhenoteVersion.class Modified Paths: -------------- phenote/trunk/src/web/WEB-INF/jsp/admin.jsp Modified: phenote/trunk/src/web/WEB-INF/jsp/admin.jsp =================================================================== --- phenote/trunk/src/web/WEB-INF/jsp/admin.jsp 2006-11-07 18:11:55 UTC (rev 188) +++ phenote/trunk/src/web/WEB-INF/jsp/admin.jsp 2006-11-07 22:48:39 UTC (rev 189) @@ -1,3 +1,4 @@ +<%@ page import="phenote.main.PhenoteVersion"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <html> @@ -17,7 +18,7 @@ Version </td> <td colspan="3" class="listContent"> - 0.9 + <%= PhenoteVersion.versionString()%> </td> </tr> <tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-07 18:12:13
|
Revision: 188 http://svn.sourceforge.net/obo/?rev=188&view=rev Author: mgibson Date: 2006-11-07 10:11:55 -0800 (Tue, 07 Nov 2006) Log Message: ----------- bulk edit now works! the table now allows multi select and you can then edit in the fields for all characters selected - this is getting closer to zfin & also i think the ctol paradigm theres now a compound transaction & a TransactionI interface to accomodate. im setting fields to * for multi select - which took a little work to make sure model wasnt set and to circumvent the stuff setting to current term (thats for when user selects syn) things now take lists of chars - like selection event char change event should probably take a TransactionI Modified Paths: -------------- phenote/trunk/src/java/phenote/edit/EditManager.java phenote/trunk/src/java/phenote/edit/UpdateTransaction.java phenote/trunk/src/java/phenote/gui/CharacterTableModel.java phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java phenote/trunk/src/java/phenote/gui/field/AbstractAutoCompList.java phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java phenote/trunk/src/java/phenote/gui/field/PostCompGui.java phenote/trunk/src/java/phenote/gui/field/TermCompList.java phenote/trunk/src/java/phenote/gui/selection/CharSelectionEvent.java phenote/trunk/src/java/phenote/gui/selection/CharSelectionListener.java phenote/trunk/src/java/phenote/gui/selection/SelectionManager.java Added Paths: ----------- phenote/trunk/src/java/phenote/edit/CompoundTransaction.java phenote/trunk/src/java/phenote/edit/TransactionI.java Added: phenote/trunk/src/java/phenote/edit/CompoundTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/CompoundTransaction.java (rev 0) +++ phenote/trunk/src/java/phenote/edit/CompoundTransaction.java 2006-11-07 18:11:55 UTC (rev 188) @@ -0,0 +1,26 @@ +package phenote.edit; + +import java.util.ArrayList; +import java.util.List; + +import org.geneontology.oboedit.datamodel.OBOClass; + +import phenote.datamodel.CharFieldEnum; +import phenote.datamodel.CharacterI; + +public class CompoundTransaction implements TransactionI { + + // for now we just have UpdateTransactions - later will have Add & Del trans + List<UpdateTransaction> childTransactions = new ArrayList<UpdateTransaction>(); + + public CompoundTransaction(List<CharacterI>chars,CharFieldEnum e, String newVal) { + for (CharacterI ch : chars) + childTransactions.add(new UpdateTransaction(ch,e,newVal)); + } + public CompoundTransaction(List<CharacterI>chars,CharFieldEnum e, OBOClass newVal) { + for (CharacterI ch : chars) + childTransactions.add(new UpdateTransaction(ch,e,newVal)); + } + + List<UpdateTransaction> getTransactions() { return childTransactions; } +} Modified: phenote/trunk/src/java/phenote/edit/EditManager.java =================================================================== --- phenote/trunk/src/java/phenote/edit/EditManager.java 2006-11-06 20:56:35 UTC (rev 187) +++ phenote/trunk/src/java/phenote/edit/EditManager.java 2006-11-07 18:11:55 UTC (rev 188) @@ -17,6 +17,8 @@ private List<CharChangeListener> charListeners = new ArrayList<CharChangeListener>(3); + private List<TransactionI> transactionList = new ArrayList<TransactionI>(); + private EditManager() {} public static EditManager inst() { @@ -30,10 +32,23 @@ } public void updateModel(Object source, UpdateTransaction ut) { + transactionList.add(ut); + updateModelUpdateTrans(source,ut); + } + + /** fires change event, doesnt add to transaction list */ + private void updateModelUpdateTrans(Object src, UpdateTransaction ut) { ut.editModel(); - CharChangeEvent e = new CharChangeEvent(source,ut); + CharChangeEvent e = new CharChangeEvent(src,ut); for (CharChangeListener l : charListeners) l.charChanged(e); } + public void updateModel(Object source, CompoundTransaction ct) { + transactionList.add(ct); + for (UpdateTransaction ut : ct.getTransactions()) + updateModelUpdateTrans(source,ut); + // or should we send out a char change event with a char list?? probably + } + } Added: phenote/trunk/src/java/phenote/edit/TransactionI.java =================================================================== --- phenote/trunk/src/java/phenote/edit/TransactionI.java (rev 0) +++ phenote/trunk/src/java/phenote/edit/TransactionI.java 2006-11-07 18:11:55 UTC (rev 188) @@ -0,0 +1,7 @@ +package phenote.edit; + + +// interface? class? +public interface TransactionI { + +} Modified: phenote/trunk/src/java/phenote/edit/UpdateTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/UpdateTransaction.java 2006-11-06 20:56:35 UTC (rev 187) +++ phenote/trunk/src/java/phenote/edit/UpdateTransaction.java 2006-11-07 18:11:55 UTC (rev 188) @@ -6,7 +6,7 @@ import phenote.datamodel.CharFieldValue; import phenote.datamodel.CharacterI; -public class UpdateTransaction { // extends Transaction? +public class UpdateTransaction implements TransactionI { // extends Transaction? // private CharacterI character; // private CharFieldEnum charFieldEnum; @@ -16,16 +16,21 @@ private CharFieldValue oldValue; //private boolean undo? - public UpdateTransaction(CharacterI c, CharFieldEnum e, String newVal, String old) { + public UpdateTransaction(CharacterI c, CharFieldEnum e, String newVal) { newValue = new CharFieldValue(newVal,c,e); // change this to get old from model - dont need to pass in - oldValue = new CharFieldValue(old,c,e); + //oldValue = new CharFieldValue(old,c,e); + oldValue = e.getValue(c); // character = c; -// charFieldEnum = e; +// charFieldEnum = e;2 // newValue = newVal; // oldValue = old; } + // hmmmm - should this be a compos - yes + //public UpdateTransaction(List<CharacterI>chars,CharFieldEnum e,String newVal) {} + + // public UpdateTransaction(CharFieldValue new, CharFieldValue old) ? /** actually maybe dont need to pas in old val - just query for it */ @@ -34,6 +39,8 @@ //oldValue = new CharFieldValue(old,c,e); oldValue = e.getValue(c); } + + // hmmmmmmm.... // /** if isDifferentia is true than update is for differentia of a post composed term*/ // public UpdateTransaction(CharacterI c, CharFieldEnum e, boolean isDifferentia, Modified: phenote/trunk/src/java/phenote/gui/CharacterTableModel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-11-06 20:56:35 UTC (rev 187) +++ phenote/trunk/src/java/phenote/gui/CharacterTableModel.java 2006-11-07 18:11:55 UTC (rev 188) @@ -79,7 +79,7 @@ /** Returns row # of row inserted */ private int addCharacter(CharacterI character) { //++rowCount; - // changes data model (fire event?) + // changes data model (fire event?) add transaction for undo! edit man? characterList.add(character); fireTableRowsInserted(getRowCount(),getRowCount()); return getRowCount() -1; @@ -88,6 +88,7 @@ void deleteSelectedRow(int deleteRow) { if (!hasRows()) return; // err msg? + // This needs to make a delete transaction for undo! edit man? characterList.remove(deleteRow); fireTableRowsDeleted(deleteRow,deleteRow); } Modified: phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java =================================================================== --- phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-06 20:56:35 UTC (rev 187) +++ phenote/trunk/src/java/phenote/gui/CharacterTablePanel.java 2006-11-07 18:11:55 UTC (rev 188) @@ -1,5 +1,8 @@ package phenote.gui; +import java.util.ArrayList; +import java.util.List; + import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Point; @@ -36,7 +39,7 @@ * for now no explicit commit - may be configurable later */ public class CharacterTablePanel extends JPanel { - private JTable characterTable; + private JTable charJTable; private CharacterTableModel characterTableModel; //private FieldPanel fieldPanel; //private JButton newButton; @@ -46,9 +49,10 @@ private JScrollBar verticalScrollBar; private boolean scrollToNewLastRowOnRepaint = false; - private int selectedRow; + //private int selectedRow; // get from file menu? private static final String SAVE_STRING = "Save data"; + // the idea of "sandbox" is that it doesnt go to db til you save/commit private boolean SANDBOX_MODE = true; // get from config... public CharacterTablePanel() { //TermPanel tp) { @@ -62,19 +66,20 @@ setMinimumSize(new Dimension(400,500)); characterTableModel = new CharacterTableModel(); - characterTable = new JTable(characterTableModel); - characterTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + charJTable = new JTable(characterTableModel); + //charJTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + charJTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); CharacterSelectionListener isl = new CharacterSelectionListener(); - characterTable.getSelectionModel().addListSelectionListener(isl); - characterTable.setRowSelectionInterval(0,0); // select 1st row - characterTable.getTableHeader().addMouseListener(new TableSorter()); + charJTable.getSelectionModel().addListSelectionListener(isl); + charJTable.setRowSelectionInterval(0,0); // select 1st row + charJTable.getTableHeader().addMouseListener(new TableSorter()); - JScrollPane tableScroll = new JScrollPane(characterTable); + JScrollPane tableScroll = new JScrollPane(charJTable); 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)); + charJTable.setPreferredScrollableViewportSize(new Dimension(500, 150)); add(tableScroll); @@ -116,19 +121,29 @@ } private int getSelectedRow() { - return characterTable.getSelectedRow(); + return charJTable.getSelectedRow(); } /** row number is zero based for tables */ private void selectRow(int row) { - if (characterTable != null && row >= 0 && row < characterTable.getRowCount()) - characterTable.setRowSelectionInterval(row,row); + if (charJTable != null && row >= 0 && row < charJTable.getRowCount()) + charJTable.setRowSelectionInterval(row,row); } + // used internally and by test phenote - should use sel man? CharacterI getSelectedCharacter() { return characterTableModel.getCharacter(getSelectedRow()); } + /** with multi select can have multiple characters selected */ + List<CharacterI> getSelectedChars() { + int[] selRows = charJTable.getSelectedRows(); + List<CharacterI> selChars = new ArrayList(selRows.length); + for (int i : selRows) + selChars.add(characterTableModel.getCharacter(i)); // get from datamodel? + return selChars; + } + // for now, for test CharacterListI getCharacterList() { return characterTableModel.getCharacterList(); @@ -170,8 +185,8 @@ else if (e.getActionCommand().equals("Delete")) { selectRow = getSelectedRow(); characterTableModel.deleteSelectedRow(selectRow); - if (selectRow >= characterTable.getRowCount()) - selectRow = characterTable.getRowCount()-1; // last row deleted + if (selectRow >= charJTable.getRowCount()) + selectRow = charJTable.getRowCount()-1; // last row deleted } else if (e.getActionCommand().equals(SAVE_STRING)) { @@ -203,14 +218,15 @@ public void valueChanged(ListSelectionEvent e) { if (!hasSelection()) // this can happen with a delete row return; - // need to track for reinstating select after data change - selectedRow = getSelectedRow(); - CharacterI character = getSelectedCharacter(); + // need to track for reinstating select after data change hmm not used anymore?? + //selectedRow = getSelectedRow(); + //CharacterI character = getSelectedCharacter(); // is this still needed?? //fieldPanel.setFieldsFromCharacter(character); // phase out... - // new way - SelectionManager.inst().selectCharacter(this,character); + // new way - change this to take list - multi! + //SelectionManager.inst().selectCharacter(this,character); + SelectionManager.inst().selectCharacters(this,getSelectedChars()); } } @@ -235,7 +251,7 @@ characterTableModel.setCharacterList(characterList); // need to repaint & select 1st item in table selectRow(0); - SelectionManager.inst().selectCharacter(this,getSelectedCharacter()); + SelectionManager.inst().selectCharacters(this,getSelectedChars()); //repaint(); //doLayout(); // ?? } @@ -259,7 +275,7 @@ public void mouseClicked(MouseEvent e) { if (e.getClickCount() != 1) return; // ? Point p = e.getPoint(); - int col = characterTable.getTableHeader().columnAtPoint(p); + int col = charJTable.getTableHeader().columnAtPoint(p); if (col == -1) return; // shift for descending // int shiftPressedInt = e.getModifiers()&InputEvent.SHIFT_MASK; Modified: phenote/trunk/src/java/phenote/gui/field/AbstractAutoCompList.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/AbstractAutoCompList.java 2006-11-06 20:56:35 UTC (rev 187) +++ phenote/trunk/src/java/phenote/gui/field/AbstractAutoCompList.java 2006-11-07 18:11:55 UTC (rev 188) @@ -45,8 +45,8 @@ //private Ontology ontology; private boolean changingCompletionList = false; - private boolean keyTyped = false; - private String previousInput = ""; + //private boolean keyTyped = false; + //private String previousInput = ""; private boolean doCompletion = true; // should we keep state of currentOboClass which is null if not a valid one? // default combo box.getSelectedItem sortof does this imperfectly @@ -64,6 +64,7 @@ private boolean editModel; //private CompletionListListener compListListener = new CompletionListListener(); private CompListSearcher compListSearcher; + private boolean setGuiForMultiSelect = false; /** @param editModel if false then ACB doesnt edit model directly (post comp) can abstract classes have constructors - if not init() */ @@ -131,13 +132,22 @@ /** text from selecting table doesnt do completion, TestPhenote does */ public void setText(String text, boolean doCompletion) { this.doCompletion = doCompletion; - this.keyTyped = doCompletion; // key has to be typed for completion + //this.keyTyped = doCompletion; // key has to be typed for completion getEditor().setItem(text); //if (charField!=null)log().debug(charField.getName()+" setting text ["+text+"]"); //new Throwable().printStackTrace(); this.doCompletion = true; // set back to default } + /** for now just clear out gui without editing model */ + void setGuiForMultiSelect() { + // flag to prevent AutoTextField.setText from setting to current term + // is there a cleaner way to do this?? - this falg may need to be generalized + // as may want for user being able to set to "" (non-required field gen-con) + setGuiForMultiSelect = true; + setText("*",false); // false -> no completion, "*"? + setGuiForMultiSelect = false; + } /** Return text in text field */ public String getText() { @@ -169,7 +179,7 @@ autoTextField = new AutoTextField(); // outer instance var for testing editor = autoTextField; // protected editor var from BCBE addDocumentListener(new AutoDocumentListener()); - getTextField().addKeyListener(new AutoKeyListener()); + //getTextField().addKeyListener(new AutoKeyListener()); } // editor is protected JTextField - wacky @@ -214,7 +224,12 @@ //super.setText(text); // this works as only time setText is called with cngCL false is with // selection - or at least so it seems - super.setText(getCurrentTermRelName()); + // well that was true but now need to clear text for multi sel + //System.out.println("ATF.settext ["+text+"] curr term rel name "+getCurrentTermRelName()); + if (setGuiForMultiSelect) // flag will probably need to be more general? + super.setText(text); + else + super.setText(getCurrentTermRelName()); // set to term name with syn select doCompletion = true; } @@ -230,23 +245,6 @@ protected abstract String getCurrentTermRelName(); - private class AutoKeyListener extends KeyAdapter { - // keyTyped doesnt seem to catch backspace in 1.5 - but did in 1.4 - odd -// public void keyTyped(KeyEvent e) { -// // return & tab should be ignored, as well as a lot of other things -// keyTyped = true; -// // this may be funny but with key type event the text has not yet be set -// // this catches cases where text changed due select/action - kinda cheap -// previousInput = getText(); -// } - public void keyReleased(KeyEvent e) { - // return & tab should be ignored, as well as a lot of other things - keyTyped = true; - // this may be funny but with key type event the text has not yet be set - // this catches cases where text changed due select/action - kinda cheap - previousInput = getText(); - } - } /** disable completion for item being selected - otherwise a popup comes up after @@ -285,7 +283,7 @@ // also i dont think this actually stops any funny behavior //if (!inputChanged()) // if input is actually same no need to recomp //return; - keyTyped = false; + //keyTyped = false; // too soon - text field doesnt have text yet.... hmmmm.... String input = getText(); // this is a vector of OBOClasses @@ -486,6 +484,23 @@ } // GARBAGE +// private class AutoKeyListener extends KeyAdapter { +// // keyTyped doesnt seem to catch backspace in 1.5 - but did in 1.4 - odd +// // public void keyTyped(KeyEvent e) { +// // // return & tab should be ignored, as well as a lot of other things +// // keyTyped = true; +// // // this may be funny but with key type event the text has not yet be set +// // // this catches cases where text changed due select/action - kinda cheap +// // previousInput = getText(); +// // } +// public void keyReleased(KeyEvent e) { +// // return & tab should be ignored, as well as a lot of other things +// //keyTyped = true; +// // this may be funny but with key type event the text has not yet be set +// // this catches cases where text changed due select/action - kinda cheap +// previousInput = getText(); +// } +// } // private void editModel() { // OBOClass oboClass; // try { oboClass = getCurrentOboClass(); } Modified: phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java 2006-11-06 20:56:35 UTC (rev 187) +++ phenote/trunk/src/java/phenote/gui/field/CharFieldGui.java 2006-11-07 18:11:55 UTC (rev 188) @@ -1,5 +1,6 @@ package phenote.gui.field; +import java.util.List; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -27,6 +28,7 @@ import phenote.datamodel.OntologyManager; import phenote.edit.CharChangeEvent; import phenote.edit.CharChangeListener; +import phenote.edit.CompoundTransaction; import phenote.edit.EditManager; import phenote.edit.UpdateTransaction; import phenote.gui.selection.CharSelectionListener; @@ -51,6 +53,8 @@ private String label; private boolean enableListeners = true; private boolean addCompButton = true; + /** if true then set gui but not model, for clearing on multi, default false */ + private boolean updateGuiOnly = false; CharFieldGui(CharField charField, FieldPanel tp) {/*Container parent,*/ @@ -94,7 +98,7 @@ } /** edits from post comp come in here i believe (term info used to but now - thats done with UseTermEvent */ + thats done with UseTermEvent) */ private class FieldCharChangeListener implements CharChangeListener { public void charChanged(CharChangeEvent e) { // check charField is this char field @@ -102,7 +106,9 @@ // i think all we need to do is setText to synch with model // for complist dont we also need to set its model (not just text??) //setText(e.getValueString()); // might as well just synch with model - setValueFromChar(getSelectedChar()); + // so in the case of multi select presumably they have all been modified in + // the same manner so sufficient to just synch with 1st one + setValueFromChar(getFirstSelectedChar()); } } @@ -274,6 +280,17 @@ if (isCompList) return getCompList().getText(); else return textField.getText(); } + /** clears gui not model - for multi select - may want to set to * or something? */ + void setGuiForMultiSelect() { + if (isCompList) { + getCompList().setGuiForMultiSelect(); + } + else { + updateGuiOnly = true; + setText("*"); // or * for multi sel? rename method setGuiForMultiSelect? + updateGuiOnly = false; + } + } void setOboClass(OBOClass term) { if (!isCompList || isRelationshipList()) return; // throw ex?? @@ -290,35 +307,48 @@ CharFieldEnum getCharFieldEnum() { return charField.getCharFieldEnum(); } - private CharacterI getSelectedChar() { - return SelectionManager.inst().getSelectedCharacter(); + private CharacterI getFirstSelectedChar() { + return SelectionManager.inst().getFirstSelectedCharacter(); } + private List<CharacterI> getSelectedChars() { + return SelectionManager.inst().getSelectedChars(); + } + // separate char text field class? /** This is where the model gets updated (for free text fields) */ private class TextFieldDocumentListener implements DocumentListener { - private String previousVal = null; + //private String previousVal = null; public void changedUpdate(DocumentEvent e) { updateModel(); } public void insertUpdate(DocumentEvent e) { updateModel(); } public void removeUpdate(DocumentEvent e) { updateModel(); } private void updateModel() { + // if only updating gui (multi select clear) then dont update model + if (updateGuiOnly) return; // on delete last pheno row clearing of text will trigger this //if (!characterTablePanel.hasRows()) return; //String genotype = lumpField.getText(); //characterTablePanel.setSelectedGenotype(genotype); - CharacterI c = getSelectedChar(); + List<CharacterI> chars = getSelectedChars(); // i believe this isnt using oboClass as we just have string // of course it isnt this is free text String v = getText(); - UpdateTransaction ut = new UpdateTransaction(c,getCharFieldEnum(),v,previousVal); - EditManager.inst().updateModel(CharFieldGui.this,ut); - previousVal = v; // undo + //UpdateTransaction ut = new UpdateTransaction(char,getCharFieldEnum(),v); + CompoundTransaction ct = new CompoundTransaction(chars,getCharFieldEnum(),v); + EditManager.inst().updateModel(CharFieldGui.this,ct); + //previousVal = v; // undo } } private class FieldCharSelectListener implements CharSelectionListener { - public void characterSelected(CharSelectionEvent e) { - setValueFromChar(e.getCharacter()); + public void charactersSelected(CharSelectionEvent e) { + // if multi select then clear out fields - alternatively could do first char + // or only show fields that are all same? + if (e.isMultiSelect()) { + setGuiForMultiSelect(); + return; + } + setValueFromChar(e.getChars().get(0)); } } Modified: phenote/trunk/src/java/phenote/gui/field/PostCompGui.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/PostCompGui.java 2006-11-06 20:56:35 UTC (rev 187) +++ phenote/trunk/src/java/phenote/gui/field/PostCompGui.java 2006-11-07 18:11:55 UTC (rev 188) @@ -1,5 +1,6 @@ package phenote.gui.field; +import java.util.List; import java.awt.BorderLayout; import java.awt.Frame; import java.awt.GridBagLayout; @@ -28,7 +29,8 @@ import phenote.edit.CharChangeEvent; import phenote.edit.CharChangeListener; import phenote.edit.EditManager; -import phenote.edit.UpdateTransaction; +//import phenote.edit.UpdateTransaction; +import phenote.edit.CompoundTransaction; import phenote.main.Phenote; import phenote.gui.selection.CharSelectionEvent; import phenote.gui.selection.CharSelectionListener; @@ -108,14 +110,15 @@ } private class CompCharSelectListener implements CharSelectionListener { - public void characterSelected(CharSelectionEvent e) { + public void charactersSelected(CharSelectionEvent e) { setGuiFromSelectedModel(); } } private OBOClass getModelTerm() { // there should be convenience method for this - CharacterI c = SelectionManager.inst().getSelectedCharacter(); + // multi select get 1st?? + CharacterI c = SelectionManager.inst().getFirstSelectedCharacter(); return charField.getCharFieldEnum().getValue(c).getOboClass(); } @@ -212,11 +215,11 @@ } private void commitTerm(OBOClass postComp) { - CharacterI c = SelectionManager.inst().getSelectedCharacter(); + List<CharacterI> chrs = SelectionManager.inst().getSelectedChars(); CharFieldEnum cfe = charField.getCharFieldEnum(); - //OBOClass previousOboClass = cfe.getValue(c).getOboClass(); - UpdateTransaction ut = new UpdateTransaction(c,cfe,postComp); - EditManager.inst().updateModel(this,ut); + //UpdateTransaction ut = new UpdateTransaction(c,cfe,postComp); + CompoundTransaction ct = new CompoundTransaction(chrs,cfe,postComp); + EditManager.inst().updateModel(this,ct); } private String pcString(String g, String d) { Modified: phenote/trunk/src/java/phenote/gui/field/TermCompList.java =================================================================== --- phenote/trunk/src/java/phenote/gui/field/TermCompList.java 2006-11-06 20:56:35 UTC (rev 187) +++ phenote/trunk/src/java/phenote/gui/field/TermCompList.java 2006-11-07 18:11:55 UTC (rev 188) @@ -1,5 +1,6 @@ package phenote.gui.field; +import java.util.List; import java.util.Vector; import javax.swing.JList; import javax.swing.event.ListSelectionEvent; @@ -12,7 +13,8 @@ import phenote.datamodel.CharacterI; import phenote.datamodel.CharFieldEnum; import phenote.edit.EditManager; -import phenote.edit.UpdateTransaction; +import phenote.edit.CompoundTransaction; +//import phenote.edit.UpdateTransaction; import phenote.gui.selection.SelectionManager; import phenote.gui.selection.UseTermEvent; import phenote.gui.selection.UseTermListener; @@ -49,7 +51,6 @@ if doesnt validate throw ex */ protected void setCurrentValidItem() throws OboException { setOboClass(getSelectedOboClass()); //this will set text to oboclass - //currentOboClass = getSelectedOboClass(); } protected String getCurrentTermRelName() { @@ -107,19 +108,19 @@ try { oboClass = getCurrentOboClass(); } catch (Exception e) { return; } // shouldnt happen, error? if (getCharField() == null) return; // shouldnt happen - CharacterI c = getSelectedCharacter(); // from selectionManager + List<CharacterI> chars = getSelectedChars(); // from selectionManager CharFieldEnum cfe = getCharField().getCharFieldEnum(); // isDifferentia boolean? - UpdateTransaction ut = new UpdateTransaction(c,cfe,oboClass); - EditManager.inst().updateModel(this,ut); + CompoundTransaction ct = new CompoundTransaction(chars,cfe,oboClass); + EditManager.inst().updateModel(this,ct); } private SelectionManager getSelectionManager() { return SelectionManager.inst(); } - private CharacterI getSelectedCharacter() { - return getSelectionManager().getSelectedCharacter(); + private List<CharacterI> getSelectedChars() { + return getSelectionManager().getSelectedChars(); } /** This is touchy stuff - so i want to be able to display info about term in Modified: phenote/trunk/src/java/phenote/gui/selection/CharSelectionEvent.java =================================================================== --- phenote/trunk/src/java/phenote/gui/selection/CharSelectionEvent.java 2006-11-06 20:56:35 UTC (rev 187) +++ phenote/trunk/src/java/phenote/gui/selection/CharSelectionEvent.java 2006-11-07 18:11:55 UTC (rev 188) @@ -1,18 +1,21 @@ package phenote.gui.selection; import java.util.EventObject; +import java.util.List; import phenote.datamodel.CharacterI; public class CharSelectionEvent extends EventObject { - private CharacterI character; + private List<CharacterI> charList; - CharSelectionEvent(Object source, CharacterI ch) { + CharSelectionEvent(Object source, List<CharacterI> chars) { super(source); - this.character= ch; + this.charList= chars; } - public CharacterI getCharacter() { return character; } + public List<CharacterI> getChars() { return charList; } -} \ No newline at end of file + public boolean isMultiSelect() { return charList.size() > 1; } + +} Modified: phenote/trunk/src/java/phenote/gui/selection/CharSelectionListener.java =================================================================== --- phenote/trunk/src/java/phenote/gui/selection/CharSelectionListener.java 2006-11-06 20:56:35 UTC (rev 187) +++ phenote/trunk/src/java/phenote/gui/selection/CharSelectionListener.java 2006-11-07 18:11:55 UTC (rev 188) @@ -1,5 +1,5 @@ package phenote.gui.selection; public interface CharSelectionListener { - public void characterSelected(CharSelectionEvent e); -} \ No newline at end of file + public void charactersSelected(CharSelectionEvent e); +} Modified: phenote/trunk/src/java/phenote/gui/selection/SelectionManager.java =================================================================== --- phenote/trunk/src/java/phenote/gui/selection/SelectionManager.java 2006-11-06 20:56:35 UTC (rev 187) +++ phenote/trunk/src/java/phenote/gui/selection/SelectionManager.java 2006-11-07 18:11:55 UTC (rev 188) @@ -15,7 +15,9 @@ private List<TermSelectionListener> termListenerList; List<CharSelectionListener> charListenerList; + // phase out for list... private CharacterI selectedCharacter; + private List<CharacterI> selectedCharList; public static SelectionManager inst() { if (singleton == null) singleton = new SelectionManager(); @@ -46,21 +48,36 @@ return new TermSelectionEvent(src,oc,l); } - public CharacterI getSelectedCharacter() { - return selectedCharacter; + public CharacterI getFirstSelectedCharacter() { + if (selectedCharList == null || selectedCharList.isEmpty()) + return null; // ex? + return selectedCharList.get(0); } - public void selectCharacter(Object source, CharacterI character) { - selectedCharacter = character; - CharSelectionEvent e = makeCharacterEvent(source,character); - for (CharSelectionListener l : charListenerList) - l.characterSelected(e); + public List<CharacterI> getSelectedChars() { + return selectedCharList; } - private CharSelectionEvent makeCharacterEvent(Object src, CharacterI c) { - return new CharSelectionEvent(src,c); +// public void selectCharacter(Object source, CharacterI character) { +// selectedCharacter = character; +// CharSelectionEvent e = makeCharacterEvent(source,character); +// for (CharSelectionListener l : charListenerList) +// l.characterSelected(e); +// } + + public void selectCharacters(Object src, List<CharacterI> chars) { + selectedCharList = chars; + //if (chars.size() == 1) { selectCharacter(src,chars.get(0)); return; } + CharSelectionEvent e = new CharSelectionEvent(src,chars); + for (CharSelectionListener l : charListenerList) + l.charactersSelected(e); } + +// private CharSelectionEvent makeCharacterEvent(Object src, CharacterI c) { +// return new CharSelectionEvent(src,c); +// } + public void addCharSelectionListener(CharSelectionListener l) { charListenerList.add(l); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-06 20:56:49
|
Revision: 187 http://svn.sourceforge.net/obo/?rev=187&view=rev Author: mgibson Date: 2006-11-06 12:56:35 -0800 (Mon, 06 Nov 2006) Log Message: ----------- well this is bit of a hack that i want to revisit - so now syns are being queried from web - and syn is displayed not term name in auto comp list - and when you select the syn its term name shows up in the field - my first attempt at doing this was to just add a onmouseclick function to the li list terms - the function gets called but then control.js does its thing and sets with syn - so now i have the onmouseclick function in the li (from backend servlet) call selectterm javascript function in ncbo.html. this function sets the elements attribute/property termName to the the termName, and then i modified controls.js updateElement function to check for the presence of termName. so this works but its hacky and i would like to revisit. so i think maybe a better way of transmitting to the term name - though still not great - is perhaps through the li elements id (or title?) - sohel had been setting the id to the id of the term and i followed suit - i dont think any of ncbo/zfin stuff uses this so maybe its ok to make that the term name - but mayb dichty uses the id??? sohel? if so could use title? (a bit cheesy) then controls.js could be subclassed instead of modified in place - and the subclass would use the id or title or the subclass could call the onmouseclick function itself - though im not sure if thats possible - dont know if the param is available at that point well im open to suggestions from javascript fiends Modified Paths: -------------- phenote/trunk/build.xml phenote/trunk/src/java/phenote/servlet/PhenoteController.java phenote/trunk/src/web/html/ncbo.html phenote/trunk/src/web/javascript/ajax-lib/controls.js Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2006-11-06 18:31:05 UTC (rev 186) +++ phenote/trunk/build.xml 2006-11-06 20:56:35 UTC (rev 187) @@ -332,6 +332,21 @@ </war> </target> + <target name="war-fiddle" depends="jar"> + <war destfile="war-deployment/phenote-fiddle.war" webxml="src/web/WEB-INF/web-fiddle.xml"> + <fileset dir="src/web"> + <exclude name="perl/*" /> + </fileset> + <lib dir="${lib}"> + <exclude name="junit-4.0.jar" /> + <exclude name="BrowserLauncher2-10rc4.jar" /> + <exclude name="tomcat-servlet.jar" /> + </lib> + <classes dir="${obo}" /> + <classes dir="${conf}" /> + </war> + </target> + <target name="war-clean"> <delete dir="war-deployment"/> </target> Modified: phenote/trunk/src/java/phenote/servlet/PhenoteController.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteController.java 2006-11-06 18:31:05 UTC (rev 186) +++ phenote/trunk/src/java/phenote/servlet/PhenoteController.java 2006-11-06 20:56:35 UTC (rev 187) @@ -32,7 +32,7 @@ protected ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { - System.out.println("in PhenoteController.handle()"); + //System.out.println("in PhenoteController.handle()"); PhenoteBean form = (PhenoteBean) command; String ontologyName = form.getOntologyName(); String field = form.getField(); Modified: phenote/trunk/src/web/html/ncbo.html =================================================================== --- phenote/trunk/src/web/html/ncbo.html 2006-11-06 18:31:05 UTC (rev 186) +++ phenote/trunk/src/web/html/ncbo.html 2006-11-06 20:56:35 UTC (rev 187) @@ -172,10 +172,20 @@ //alert('use term info fn called - field '+field+' name '+termName); <!-- document.termForm.qualityInput.value=document.termForm.termId.value; --> if (field == "ENTITY") { - document.termForm.entityInput.value = termName; + // useless to set value as controls.js overrides (sets afterwards) + // unless controls.js is disabled for this? or subclass + //document.termForm.entityInput.value = termName; + // this is admittedly cheesy - controls.js has been hacked to check for + // entityInput.termName - better solution might be first to subclass + // controls.js (so can take in future versions of controls) and maybe send + // is id or title in li element from backend/servlet itself - then dont + // even need this hacky function and dont have to do if statement on + // field + document.termForm.entityInput.termName = termName; } else { - document.termForm.qualityInput.value= termName; + // see hack comment above + document.termForm.qualityInput.termName= termName; } } </script> Modified: phenote/trunk/src/web/javascript/ajax-lib/controls.js =================================================================== --- phenote/trunk/src/web/javascript/ajax-lib/controls.js 2006-11-06 18:31:05 UTC (rev 186) +++ phenote/trunk/src/web/javascript/ajax-lib/controls.js 2006-11-06 20:56:35 UTC (rev 187) @@ -242,7 +242,17 @@ newValue += whitespace[0]; this.element.value = newValue + value; } else { - this.element.value = value; + // MARK GIBSON ADDITIONS/HACKS - put into subclass! + // currently ncbo.html is setting element.termName in onclick function + // selectTerm - another way would be to pass term in id or title? + // but sohel puts term id in id - ask him about this +//alert("controls.js updateElement "+this.element.value+" to "+value+"termName? "+this.element.termName+" id? "+this.element.id+" termtest? "+this.element.termTest+" selEl "+selectedElement.id+ " sel el term test "+selectedElement.termTest); + if (this.element.termName != null) { + this.element.value = this.element.termName; + } + else { + this.element.value = value; + } } this.element.focus(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-06 18:31:24
|
Revision: 186 http://svn.sourceforge.net/obo/?rev=186&view=rev Author: mgibson Date: 2006-11-06 10:31:05 -0800 (Mon, 06 Nov 2006) Log Message: ----------- PhenoteVersion simple class for version of phenote - call with PhenoteVersion.versionString Onotlogy has getVersion method - for version of ontology (not phenote) but obo session doesnt seem to have version info in it - getLoadRemark just says what file it came from - hopefully john will ammend this Modified Paths: -------------- phenote/trunk/src/java/phenote/datamodel/Ontology.java phenote/trunk/src/java/phenote/main/Phenote.java Added Paths: ----------- phenote/trunk/src/java/phenote/main/PhenoteVersion.java Modified: phenote/trunk/src/java/phenote/datamodel/Ontology.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/Ontology.java 2006-11-06 16:10:14 UTC (rev 185) +++ phenote/trunk/src/java/phenote/datamodel/Ontology.java 2006-11-06 18:31:05 UTC (rev 186) @@ -52,6 +52,12 @@ public Date getOntologyDate() { return new Date(ontologyTimestamp); } + public String getVersion() { + // this is wrong - this just says file name loaded from. obo file puts version in + // remark field but doesnt seem to be way to get that from obo session?? + return oboSession.getLoadRemark(); + } + private void makeSortedLists(OBOSession oboSession) { //log().debug("name "+name+" terms "+oboSession.getTerms()+" propVals "+oboSession.getPropertyValues()+" rels "+oboSession.getRelationshipTypes()); sortedTerms = getSortedTerms(oboSession.getTerms()); @@ -127,7 +133,8 @@ /** meght move this elsewhere - subclass? data adap specific wrapper? */ public void setTimestamp(long t) { ontologyTimestamp = t; - log().info(getName()+" Ontology date: "+getOntologyDate()); + log().info("\n"+getName()+" Ontology date: "+getOntologyDate() + +"\nVersion: "+getVersion()); } public long getTimestamp() { return ontologyTimestamp; } /** for obo files this is the filename */ Modified: phenote/trunk/src/java/phenote/main/Phenote.java =================================================================== --- phenote/trunk/src/java/phenote/main/Phenote.java 2006-11-06 16:10:14 UTC (rev 185) +++ phenote/trunk/src/java/phenote/main/Phenote.java 2006-11-06 18:31:05 UTC (rev 186) @@ -32,8 +32,7 @@ public class Phenote { - private static final String VERSION = "0.8.2 dev"; - //private static final String DEFAULT_CONFIG_FILE = Config.DEFAULT_CONFIG_FILE; + //private static final String VERSION = "0.8.2 dev"; private static final Logger LOG = Logger.getLogger(Phenote.class); private static boolean standalone = false; // default for servlet @@ -47,7 +46,7 @@ public static void main(String[] args) { standalone = true; // i think this is ok - System.out.println("This is Phenote version "+VERSION); + System.out.println("This is Phenote version "+PhenoteVersion.versionString()); // default mac lok & feel is "Mac OS X", but the JComboBox is buggy try { UIManager.setLookAndFeel(new MetalLookAndFeel()); @@ -162,7 +161,8 @@ public Frame getFrame() { return frame; } private void makeWindow() { - frame = new JFrame("Phenote "+VERSION); // this may be changed to applet... + // this may be changed to applet... + frame = new JFrame("Phenote "+PhenoteVersion.versionString()); frame.getContentPane().add(makeMainPanel()); MenuManager.createMenuManager(frame); frame.setPreferredSize(new Dimension(1100,550)); Added: phenote/trunk/src/java/phenote/main/PhenoteVersion.java =================================================================== --- phenote/trunk/src/java/phenote/main/PhenoteVersion.java (rev 0) +++ phenote/trunk/src/java/phenote/main/PhenoteVersion.java 2006-11-06 18:31:05 UTC (rev 186) @@ -0,0 +1,19 @@ +package phenote.main; + +/** Simple class for phenote version number - for standalone & servlet */ + +public class PhenoteVersion { + + //private static final float MAJOR_VERSION_NUM = 0.8f; + //private static final float SUB_VERSION_NUM = .3f; + private static final String VERSION = "0.8.3 dev"; // ?? + // type is "dev" or "release" + //private static final String type = " dev"; // "release" + + public static String versionString() { + //return MAJOR_VERSION_NUM +""+ SUB_VERSION_NUM + type; + return VERSION; + } + + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-06 16:10:31
|
Revision: 185 http://svn.sourceforge.net/obo/?rev=185&view=rev Author: mgibson Date: 2006-11-06 08:10:14 -0800 (Mon, 06 Nov 2006) Log Message: ----------- added Date getOntologyDate to Ontology for christians ontology status page Modified Paths: -------------- phenote/trunk/src/java/phenote/datamodel/Ontology.java Modified: phenote/trunk/src/java/phenote/datamodel/Ontology.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/Ontology.java 2006-11-03 23:20:18 UTC (rev 184) +++ phenote/trunk/src/java/phenote/datamodel/Ontology.java 2006-11-06 16:10:14 UTC (rev 185) @@ -4,6 +4,7 @@ //import java.util.Collection; import java.util.Collections; import java.util.Comparator; +import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -49,6 +50,8 @@ filterLists(); } + public Date getOntologyDate() { return new Date(ontologyTimestamp); } + private void makeSortedLists(OBOSession oboSession) { //log().debug("name "+name+" terms "+oboSession.getTerms()+" propVals "+oboSession.getPropertyValues()+" rels "+oboSession.getRelationshipTypes()); sortedTerms = getSortedTerms(oboSession.getTerms()); @@ -121,8 +124,11 @@ return sortedTerms; } - /** moght move this elsewhere - subclass? data adap specific wrapper? */ - public void setTimestamp(long t) { ontologyTimestamp = t; } + /** meght move this elsewhere - subclass? data adap specific wrapper? */ + public void setTimestamp(long t) { + ontologyTimestamp = t; + log().info(getName()+" Ontology date: "+getOntologyDate()); + } public long getTimestamp() { return ontologyTimestamp; } /** for obo files this is the filename */ public void setSource(String s) { source = s; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-03 23:20:20
|
Revision: 184 http://svn.sourceforge.net/obo/?rev=184&view=rev Author: mgibson Date: 2006-11-03 15:20:18 -0800 (Fri, 03 Nov 2006) Log Message: ----------- reinstated synonym changes that got lost in transfer from PhenoteServlet to PhenoteController syn search params are true syns come back with synonym not term name with [syn] at end working on having term name be the selection when syn is selected Modified Paths: -------------- phenote/trunk/src/java/phenote/servlet/PhenoteController.java Modified: phenote/trunk/src/java/phenote/servlet/PhenoteController.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/PhenoteController.java 2006-11-03 23:17:33 UTC (rev 183) +++ phenote/trunk/src/java/phenote/servlet/PhenoteController.java 2006-11-03 23:20:18 UTC (rev 184) @@ -32,6 +32,7 @@ protected ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { + System.out.println("in PhenoteController.handle()"); PhenoteBean form = (PhenoteBean) command; String ontologyName = form.getOntologyName(); String field = form.getField(); @@ -80,6 +81,10 @@ try { Vector<CompletionTerm> v = getCompListSearcher(ontologyName).getStringMatchTerms(userInput); //Vector<OBOClass> v = ontology.getStringMatchTerms(userInput, getSearchParams()); + // a tad cheesy but if hit no terms then auto comp shows nothing + // add an empty item should show then an empty list? + if (v.isEmpty()) + sb.append("<li></li>"); for (CompletionTerm ct : v) sb.append(makeCompListHtmlItem(ct, ontologyName, field)); } @@ -90,15 +95,18 @@ return sb.toString(); } - private Object makeCompListHtmlItem(CompletionTerm term, String ontol, String field) { - String id = term.getID(), name = term.getName(); + private String makeCompListHtmlItem(CompletionTerm term, String ontol,String field) { + String id = term.getID(), name=term.getName(); + String display = term.getCompListDisplayString(); // pass in id, name & ontology - name for setting field on UseTerm - StringBuffer info = dq(fn("getTermInfo", new String[]{id, name, ontol, field})); + StringBuffer info = dq(fn("getTermInfo",new String[]{id,name,ontol,field})); + StringBuffer select = dq(fn("selectTerm",new String[]{name,field})); //String info = "\"getTermInfo("+id +","+q(name)+","+ q(ontol) + ")\""; - return "<li onmouseover=" + info + " id=" + q(id) + " " + - "onclick=" + info + ">" + name + "</li>\n"; + return "<li onmouseover=" + info + " id=" + q(id) + " termTest='dude' " + + " onclick=" + select + ">" + display + "</li>\n"; } + private CompListSearcher getCompListSearcher(String ontologyName) throws OntologyException { return new CompListSearcher(getOntology(ontologyName), getSearchParams()); } @@ -135,11 +143,11 @@ } public boolean searchSynonyms() { - return false; // --> true + return true; // --> true } public boolean searchDefinitions() { - return false; // ?? w [def]?? + return false; // ?? w [def]?? zfin not keen on defs } /** @@ -147,10 +155,17 @@ * This should be in conjunction with the other 3 */ public boolean searchObsoletes() { - return false; // --> true w [obs], disallow selection + return true; // --> true w [obs], disallow selection } } - } +// private Object makeCompListHtmlItemOLD(CompletionTerm term, String ontol, String field) { +// String id = term.getID(), name = term.getName(); +// // pass in id, name & ontology - name for setting field on UseTerm +// StringBuffer info = dq(fn("getTermInfo", new String[]{id, name, ontol, field})); +// //String info = "\"getTermInfo("+id +","+q(name)+","+ q(ontol) + ")\""; +// return "<li onmouseover=" + info + " id=" + q(id) + " " + +// "onclick=" + info + ">" + name + "</li>\n"; +// } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-03 23:17:38
|
Revision: 183 http://svn.sourceforge.net/obo/?rev=183&view=rev Author: mgibson Date: 2006-11-03 15:17:33 -0800 (Fri, 03 Nov 2006) Log Message: ----------- ant war doesnt mkdir war-deployment anymore uses existing - which ideally is a symbolic link to web land - at least for me it is Modified Paths: -------------- phenote/trunk/build.xml Modified: phenote/trunk/build.xml =================================================================== --- phenote/trunk/build.xml 2006-11-03 23:02:48 UTC (rev 182) +++ phenote/trunk/build.xml 2006-11-03 23:17:33 UTC (rev 183) @@ -298,10 +298,11 @@ </copy> <copy todir="${web.xml-dir}"> <fileset file="src/web/WEB-INF/web.xml"/> + <fileset file="src/web/WEB-INF/phenote-servlet.xml"/> </copy> </target> - <target name="war" depends="jar, war-clean"> + <target name="war-init-dir" depends="jar, war-clean"> <mkdir dir="war-deployment"/> <war destfile="war-deployment/phenote.war" webxml="src/web/WEB-INF/web.xml"> <fileset dir="src/web"> @@ -316,6 +317,20 @@ <classes dir="${conf}" /> </war> </target> + <target name="war" depends="jar"> + <war destfile="war-deployment/phenote.war" webxml="src/web/WEB-INF/web.xml"> + <fileset dir="src/web"> + <exclude name="perl/*" /> + </fileset> + <lib dir="${lib}"> + <exclude name="junit-4.0.jar" /> + <exclude name="BrowserLauncher2-10rc4.jar" /> + <exclude name="tomcat-servlet.jar" /> + </lib> + <classes dir="${obo}" /> + <classes dir="${conf}" /> + </war> + </target> <target name="war-clean"> <delete dir="war-deployment"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2006-11-03 23:03:03
|
Revision: 182 http://svn.sourceforge.net/obo/?rev=182&view=rev Author: cmpich Date: 2006-11-03 15:02:48 -0800 (Fri, 03 Nov 2006) Log Message: ----------- Added a simple home page that points to test pages and an admin page changed svn to use native eol style so that Win users do not mess up the EOL characters Modified Paths: -------------- phenote/trunk/src/web/WEB-INF/jsp/ajax.jsp phenote/trunk/src/web/WEB-INF/phenote-servlet.xml phenote/trunk/src/web/WEB-INF/web.xml Added Paths: ----------- phenote/trunk/jars/jstl-1.1.jar phenote/trunk/src/java/phenote/servlet/AdminBean.java phenote/trunk/src/java/phenote/servlet/AdminController.java phenote/trunk/src/web/WEB-INF/jsp/admin.jsp phenote/trunk/src/web/css/phenote.css phenote/trunk/src/web/index.html Property Changed: ---------------- phenote/trunk/src/java/phenote/servlet/PhenoteBean.java phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java phenote/trunk/src/web/WEB-INF/jsp/ajax.jsp phenote/trunk/src/web/css/control.css Added: phenote/trunk/jars/jstl-1.1.jar =================================================================== (Binary files differ) Property changes on: phenote/trunk/jars/jstl-1.1.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: phenote/trunk/src/java/phenote/servlet/AdminBean.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/AdminBean.java (rev 0) +++ phenote/trunk/src/java/phenote/servlet/AdminBean.java 2006-11-03 23:02:48 UTC (rev 182) @@ -0,0 +1,25 @@ +package phenote.servlet; + +import phenote.datamodel.Ontology; + +import java.util.List; + +/** + * Created by IntelliJ IDEA. + * User: Christian Pich + * Date: Nov 3, 2006 + * Time: 10:57:20 AM + * To change this template use File | Settings | File Templates. + */ +public class AdminBean { + + private List<Ontology> ontologies; + + public List<Ontology> getOntologies() { + return ontologies; + } + + public void setOntologies(List<Ontology> ontologies) { + this.ontologies = ontologies; + } +} Added: phenote/trunk/src/java/phenote/servlet/AdminController.java =================================================================== --- phenote/trunk/src/java/phenote/servlet/AdminController.java (rev 0) +++ phenote/trunk/src/java/phenote/servlet/AdminController.java 2006-11-03 23:02:48 UTC (rev 182) @@ -0,0 +1,28 @@ +package phenote.servlet; + +import org.springframework.web.servlet.mvc.Controller; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import phenote.datamodel.Ontology; +import phenote.datamodel.OntologyManager; + +import java.util.List; + +/** + * Controller that serves the version page: lists ontologies and their + * meta data. + */ +public class AdminController implements Controller { + + public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { + + AdminBean form = new AdminBean(); + List<Ontology> ontologies = OntologyManager.inst().getAllOntologies(); + form.setOntologies(ontologies); + + return new ModelAndView("admin", "formBean", form); + } +} Property changes on: phenote/trunk/src/java/phenote/servlet/PhenoteBean.java ___________________________________________________________________ Name: svn:eol-style + native Property changes on: phenote/trunk/src/java/phenote/servlet/PhenoteServlet.java ___________________________________________________________________ Name: svn:eol-style + native Added: phenote/trunk/src/web/WEB-INF/jsp/admin.jsp =================================================================== --- phenote/trunk/src/web/WEB-INF/jsp/admin.jsp (rev 0) +++ phenote/trunk/src/web/WEB-INF/jsp/admin.jsp 2006-11-03 23:02:48 UTC (rev 182) @@ -0,0 +1,55 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> + +<html> +<head> + <title>List of Ontologies</title> + <link type="text/css" rel="stylesheet" href="<%= request.getContextPath()%>/css/phenote.css"/> +</head> + +<body> + + +<table cellpadding="2" cellspacing="1" border="0" width="80%"> + + <tr><td colspan="4" class="sectionTitle">Phenote Application</td></tr> + <tr> + <td class="listContentBold"> + Version + </td> + <td colspan="3" class="listContent"> + 0.9 + </td> + </tr> + <tr> + <td class="listContentBold"> + Date + </td> + <td colspan="3" class="listContent"> + 2006 + </td> + </tr> + <tr><td colspan="4" class="sectionTitle"> List of Ontologies</td></tr> + <tr> + <td width="100" class="sectionTitle">Ontology Name</td> + <td class="sectionTitle">Version</td> + <td class="sectionTitle">File Name</td> + <td class="sectionTitle">File Date</td> + </tr> + <c:forEach var="item" items="${formBean.ontologies}"> + <tr> + <td class="listContentBold"> + <c:out value='${item.name}'/> + </td> + <td class="listContent"> + </td> + <td class="listContent"> + <c:out value='${item.source}'/> + </td> + <td class="listContent"> + </td> + </tr> + </c:forEach> +</table> +</body> +</html> + Property changes on: phenote/trunk/src/web/WEB-INF/jsp/admin.jsp ___________________________________________________________________ Name: svn:eol-style + native Modified: phenote/trunk/src/web/WEB-INF/jsp/ajax.jsp =================================================================== --- phenote/trunk/src/web/WEB-INF/jsp/ajax.jsp 2006-11-03 19:38:34 UTC (rev 181) +++ phenote/trunk/src/web/WEB-INF/jsp/ajax.jsp 2006-11-03 23:02:48 UTC (rev 182) @@ -1,6 +1,6 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> -<html> -<body> -<c:out value="${formBean.ajaxList}" escapeXml="false"/> -</body> +<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> +<html> +<body> +<c:out value="${formBean.ajaxList}" escapeXml="false"/> +</body> </html> \ No newline at end of file Property changes on: phenote/trunk/src/web/WEB-INF/jsp/ajax.jsp ___________________________________________________________________ Name: svn:eol-style + native Modified: phenote/trunk/src/web/WEB-INF/phenote-servlet.xml =================================================================== --- phenote/trunk/src/web/WEB-INF/phenote-servlet.xml 2006-11-03 19:38:34 UTC (rev 181) +++ phenote/trunk/src/web/WEB-INF/phenote-servlet.xml 2006-11-03 23:02:48 UTC (rev 182) @@ -15,6 +15,8 @@ <bean name="/" class="phenote.servlet.PhenoteController"/> + <bean name="/admin.ph" class="phenote.servlet.AdminController"/> + <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" > <property name="prefix"> <value>/WEB-INF/jsp/</value> @@ -46,7 +48,28 @@ </property> </bean> - <bean id="cronOntologyTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> + <bean id="geneOntologyReloadJob" class="org.springframework.scheduling.quartz.JobDetailBean"> + <property name="jobClass"> + <value>phenote.jobs.OntologyUpdateJob</value> + </property> + <property name="jobDataAsMap"> + <map> + <entry key="ontologyName"> + <value>GO</value> + </entry> + <!-- This directory is relative to the webroot --> + <entry key="archiveDirectory"> + <value>archive-ontology</value> + </entry> + <!-- time stated in days (can be a fraction) --> + <entry key="purgePeriodInDays"> + <value>0.0035</value> + </entry> + </map> + </property> + </bean> + + <bean id="cronAOTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail"> <ref bean="anatomyOntologyReloadJob"/> </property> @@ -58,7 +81,7 @@ <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> - <ref bean="cronOntologyTrigger"/> + <ref bean="cronAOTrigger"/> </list> </property> </bean> Modified: phenote/trunk/src/web/WEB-INF/web.xml =================================================================== --- phenote/trunk/src/web/WEB-INF/web.xml 2006-11-03 19:38:34 UTC (rev 181) +++ phenote/trunk/src/web/WEB-INF/web.xml 2006-11-03 23:02:48 UTC (rev 182) @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app - PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" - "http://java.sun.com/j2ee/dtds/web-app_2_4.dtd"> + PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet> @@ -20,7 +19,7 @@ </servlet-mapping> <welcome-file-list> - <welcome-file>html/ncbo.html</welcome-file> + <welcome-file>/index.html</welcome-file> </welcome-file-list> </web-app> Property changes on: phenote/trunk/src/web/css/control.css ___________________________________________________________________ Name: svn:eol-style + native Added: phenote/trunk/src/web/css/phenote.css =================================================================== --- phenote/trunk/src/web/css/phenote.css (rev 0) +++ phenote/trunk/src/web/css/phenote.css 2006-11-03 23:02:48 UTC (rev 182) @@ -0,0 +1,26 @@ +.sectionTitle { + color: #FFFFFF; + font-size: 10pt; + line-height: 15pt; + font-weight: bold; + padding-left: 10px; + background-color: #000000; +} + +.listContent { + font-size: 10pt; + padding-left: 10px; + padding-right: 10px; + vertical-align: top; + background-color: #EEEEEE; +} + +.listContentBold { + font-size: 10pt; + padding-left: 10px; + padding-right: 10px; + font-weight: bold; + vertical-align: top; + background-color: #EEEEEE; +} + Added: phenote/trunk/src/web/index.html =================================================================== --- phenote/trunk/src/web/index.html (rev 0) +++ phenote/trunk/src/web/index.html 2006-11-03 23:02:48 UTC (rev 182) @@ -0,0 +1,40 @@ +<html> +<head> + <title>Phenote Web Admin</title> + <link type="text/css" rel="stylesheet" href="/phenote/css/phenote.css"/> +</head> + +<body> + +<table cellpadding="2" cellspacing="1" border="0" width="80%"> + + <tr><td colspan="3" class="sectionTitle">Phenote Application:</td></tr> + + <tr> + <td valign=top class="listContentBold"> + Check ncbo test page: </td> + <td colspan="2" class="listContent"> + <a href="html/ncbo.html">NCBO Test page</a> + </td> + </tr> + <tr> + <td valign=top class="listContentBold"> + Test Ajax Return String: + </td> + <td colspan="2" class="listContent"> + <a href="html/ajax-test.html">Test Ajax Return String</a> + </td> + </tr> + + <tr> + <td valign=top class="listContentBold"> + Phenote Versions: </td> + <td colspan="2" class="listContent"> + <a href="Phenote/admin.ph">Versions</a> + </td> + </tr> +</table> + + +</body> +</html> \ No newline at end of file Property changes on: phenote/trunk/src/web/index.html ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mg...@us...> - 2006-11-03 19:38:40
|
Revision: 181 http://svn.sourceforge.net/obo/?rev=181&view=rev Author: mgibson Date: 2006-11-03 11:38:34 -0800 (Fri, 03 Nov 2006) Log Message: ----------- added getAllOntologies convenience method for christians spring work - it goes through the char fields and gets there ontologies - better than maintaining 2 overlapping data structures char fields and ontologies - so took out the internal ontology list that was there. Modified Paths: -------------- phenote/trunk/src/java/phenote/datamodel/OntologyManager.java Modified: phenote/trunk/src/java/phenote/datamodel/OntologyManager.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/OntologyManager.java 2006-11-02 21:41:54 UTC (rev 180) +++ phenote/trunk/src/java/phenote/datamodel/OntologyManager.java 2006-11-03 19:38:34 UTC (rev 181) @@ -25,7 +25,7 @@ private static OntologyManager singleton; // isnt this redundant with charFieldList? convenience? - phase out! just getOClass - private List<Ontology> allOntologyList = new ArrayList<Ontology>(); + //private List<Ontology> allOntologyList = new ArrayList<Ontology>(); /** 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); @@ -42,7 +42,7 @@ public void addField(CharField cf) { - addOntologyList(cf.getOntologyList()); + //addOntologyList(cf.getOntologyList()); charFieldList.add(cf); } @@ -50,6 +50,13 @@ has one or more ontologies (entity char field often has more than ontology)*/ public List<CharField> getCharFieldList() { return charFieldList; } + public List<Ontology> getAllOntologies() { + List<Ontology> ontologies = new ArrayList<Ontology>(); + for (CharField cf : charFieldList) + ontologies.addAll(cf.getOntologyList()); + return ontologies; + } + /** Returns ontology with name, null if not found */ public Ontology getOntologyForName(String ontologyName) throws OntologyException { // static? @@ -64,13 +71,13 @@ } - private void addOntologyList(List<Ontology> l) { - allOntologyList.addAll(l); - } +// private void addOntologyList(List<Ontology> l) { +// allOntologyList.addAll(l); +// } - private void addOntology(Ontology o) { - allOntologyList.add(o); - } +// private void addOntology(Ontology o) { +// allOntologyList.add(o); +// } /** Searches all ontologies for id - this could be even more savvy and utilize the id prefix AO,GO,PATO... @@ -81,9 +88,10 @@ public OBOClass getOboClass(String id) throws TermNotFoundException { OBOClass oboClass; // this seems to be the sole reason for ontology list - silly! use char fields! - Iterator<Ontology> iter = allOntologyList.iterator(); - while (iter.hasNext()) { - Ontology o = iter.next(); + //Iterator<Ontology> iter = getAllOntologies().iterator(); // allOntologyList + //while (iter.hasNext()) { + for (Ontology o : getAllOntologies()) { + //Ontology o = iter.next(); try { oboClass = o.getOboClass(id); } catch (OntologyException e) { continue; } if (oboClass != null) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |