From: Jim Procter Date: Thu, 6 Nov 2014 16:33:25 +0000 (+0000) Subject: Merge branch 'features/JAL-1541_BioJsMSAViewer-export-option' into develop X-Git-Tag: Jalview_2_9~155^2~13 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f67c7d466d9fcdea6870a42b3a888ad173cedd39;hp=961eec1363ddc5f0f5a08b9063a7a2a9b1c9d2bd;p=jalview.git Merge branch 'features/JAL-1541_BioJsMSAViewer-export-option' into develop --- diff --git a/schemas/vamsas.xsd b/schemas/vamsas.xsd index e56a6c8..646a222 100755 --- a/schemas/vamsas.xsd +++ b/schemas/vamsas.xsd @@ -185,6 +185,12 @@ + + + + + + diff --git a/src/MCview/PDBChain.java b/src/MCview/PDBChain.java index 6055a5b..5dd38a4 100755 --- a/src/MCview/PDBChain.java +++ b/src/MCview/PDBChain.java @@ -23,6 +23,7 @@ package MCview; import jalview.analysis.AlignSeq; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.Annotation; +import jalview.datamodel.Mapping; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; @@ -53,7 +54,16 @@ public class PDBChain public int offset; - public Sequence sequence; + /** + * sequence is the sequence extracted by the chain parsing code + */ + public SequenceI sequence; + + /** + * shadow is the sequence created by any other parsing processes (e.g. Jmol, + * RNAview) + */ + public SequenceI shadow = null; public boolean isNa = false; @@ -80,6 +90,8 @@ public class PDBChain */ protected String newline = System.getProperty("line.separator"); + public Mapping shadowMap; + public void setNewlineString(String nl) { newline = nl; @@ -493,11 +505,51 @@ public class PDBChain public void transferResidueAnnotation(StructureMapping mapping) { SequenceI sq = mapping.getSequence(); + SequenceI dsq = sq; if (sq != null) { - if (sequence != null && sequence.getAnnotation() != null) + while (dsq.getDatasetSequence() != null) + { + dsq = dsq.getDatasetSequence(); + } + // any annotation will be transferred onto the dataset sequence + + if (shadow != null && shadow.getAnnotation() != null) { + for (AlignmentAnnotation ana : shadow.getAnnotation()) + { + List transfer = sq.getAlignmentAnnotations( + ana.getCalcId(), ana.label); + if (transfer == null || transfer.size() == 0) + { + ana.liftOver(sequence, shadowMap); + mapping.transfer(ana); + } + else + { + continue; + } + } + } + else + { + if (sequence != null && sequence.getAnnotation() != null) + { + for (AlignmentAnnotation ana : sequence.getAnnotation()) + { + List transfer = sq.getAlignmentAnnotations( + ana.getCalcId(), ana.label); + if (transfer == null || transfer.size() == 0) + { + mapping.transfer(ana); + } + else + { + continue; + } + } + } } float min = -1, max = 0; Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1]; diff --git a/src/MCview/PDBfile.java b/src/MCview/PDBfile.java index a99f172..b22eb29 100755 --- a/src/MCview/PDBfile.java +++ b/src/MCview/PDBfile.java @@ -33,11 +33,12 @@ import java.awt.Color; import java.io.IOException; import java.util.ArrayList; import java.util.Hashtable; +import java.util.List; import java.util.Vector; public class PDBfile extends jalview.io.AlignFile { - public Vector chains; + public Vector chains; public String id; @@ -181,15 +182,15 @@ public class PDBfile extends jalview.io.AlignFile } for (int i = 0; i < chains.size(); i++) { - SequenceI dataset = ((PDBChain) chains.elementAt(i)).sequence; + SequenceI dataset = chains.elementAt(i).sequence; dataset.setName(id + "|" + dataset.getName()); PDBEntry entry = new PDBEntry(); entry.setId(id); entry.setProperty(new Hashtable()); - if (((PDBChain) chains.elementAt(i)).id != null) + if (chains.elementAt(i).id != null) { entry.getProperty().put("CHAIN", - ((PDBChain) chains.elementAt(i)).id); + chains.elementAt(i).id); } if (inFile != null) { @@ -272,19 +273,19 @@ public class PDBfile extends jalview.io.AlignFile markCalcIds(); } - private static String calcIdPrefix = "JalviewPDB:"; + private static String calcIdPrefix = "JalviewPDB"; public static boolean isCalcIdHandled(String calcId) { return calcId != null - && (calcId.startsWith(calcIdPrefix) && calcId.indexOf( - calcIdPrefix, - calcIdPrefix.length() + 1) > -1); + && (calcIdPrefix.equals(calcId)); } - public static boolean isCalcIdForFile(String calcId, String pdbFile) + + public static boolean isCalcIdForFile(AlignmentAnnotation alan, String pdbFile) { - return (calcId != null && calcId.startsWith(calcIdPrefix + pdbFile - + ":" + calcIdPrefix)); + return alan.getCalcId() != null + && calcIdPrefix.equals(alan.getCalcId()) + && pdbFile.equals(alan.getProperty("PDBID")); } public static String relocateCalcId(String calcId, @@ -307,7 +308,9 @@ public class PDBfile extends jalview.io.AlignFile { oldId = ""; } - aa.setCalcId("JalviewPDB:" + id + ":JalviewPDB:" + oldId); + aa.setCalcId(calcIdPrefix); + aa.setProperty("PDBID", id); + aa.setProperty("oldCalcId", oldId); } } } @@ -338,13 +341,43 @@ public class PDBfile extends jalview.io.AlignFile sq.getPDBId().clear(); } } - AlignSeq.replaceMatchingSeqsWith(seqs, annotations, prot, al, AlignSeq.PEP, false); + replaceAndUpdateChains(prot, al, AlignSeq.PEP, false); } } catch (ClassNotFoundException q) { } } + private void replaceAndUpdateChains(ArrayList prot, + AlignmentI al, String pep, boolean b) + { + List> replaced = AlignSeq + .replaceMatchingSeqsWith(seqs, + annotations, prot, al, AlignSeq.PEP, false); + for (PDBChain ch : chains) + { + int p = 0; + for (SequenceI sq : (List) replaced.get(0)) + { + p++; + if (sq == ch.sequence || sq.getDatasetSequence() == ch.sequence) + { + p = -p; + break; + } + } + if (p < 0) + { + p = -p - 1; + // set shadow entry for chains + ch.shadow = (SequenceI) replaced.get(1).get(p); + ch.shadowMap = ((AlignSeq) replaced.get(2) +.get(p)) + .getMappingFromS1(false); + } + } + } + private void processPdbFileWithAnnotate3d(ArrayList rna) throws Exception { @@ -370,14 +403,20 @@ public class PDBfile extends jalview.io.AlignFile { if (sq.getDatasetSequence() != null) { - sq.getDatasetSequence().getPDBId().clear(); + if (sq.getDatasetSequence().getPDBId() != null) + { + sq.getDatasetSequence().getPDBId().clear(); + } } else { - sq.getPDBId().clear(); + if (sq.getPDBId() != null) + { + sq.getPDBId().clear(); + } } } - AlignSeq.replaceMatchingSeqsWith(seqs, annotations, rna, al, AlignSeq.DNA, false); + replaceAndUpdateChains(rna, al, AlignSeq.DNA, false); } } catch (ClassNotFoundException x) { @@ -406,7 +445,7 @@ public class PDBfile extends jalview.io.AlignFile { for (int i = 0; i < chains.size(); i++) { - ((PDBChain) chains.elementAt(i)).makeResidueList(); + chains.elementAt(i).makeResidueList(); } } @@ -414,7 +453,7 @@ public class PDBfile extends jalview.io.AlignFile { for (int i = 0; i < chains.size(); i++) { - ((PDBChain) chains.elementAt(i)).makeCaBondList(); + chains.elementAt(i).makeCaBondList(); } } @@ -422,9 +461,9 @@ public class PDBfile extends jalview.io.AlignFile { for (int i = 0; i < chains.size(); i++) { - if (((PDBChain) chains.elementAt(i)).id.equals(id)) + if (chains.elementAt(i).id.equals(id)) { - return (PDBChain) chains.elementAt(i); + return chains.elementAt(i); } } @@ -435,7 +474,7 @@ public class PDBfile extends jalview.io.AlignFile { for (int i = 0; i < chains.size(); i++) { - ((PDBChain) chains.elementAt(i)).setChargeColours(); + chains.elementAt(i).setChargeColours(); } } @@ -443,7 +482,7 @@ public class PDBfile extends jalview.io.AlignFile { for (int i = 0; i < chains.size(); i++) { - ((PDBChain) chains.elementAt(i)).setChainColours(cs); + chains.elementAt(i).setChainColours(cs); } } @@ -451,7 +490,7 @@ public class PDBfile extends jalview.io.AlignFile { for (int i = 0; i < chains.size(); i++) { - ((PDBChain) chains.elementAt(i)).setChainColours(Color.getHSBColor( + chains.elementAt(i).setChainColours(Color.getHSBColor( 1.0f / i, .4f, 1.0f)); } } diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java index f5afa9c..c546310 100755 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@ -1069,11 +1069,19 @@ public class AlignSeq * @param ochains * @param al * @param dnaOrProtein - * @param removeOldAnnots when true, old annotation is cleared before new annotation transferred + * @param removeOldAnnots + * when true, old annotation is cleared before new annotation + * transferred + * @return List originals, List replacement, + * List alignment between each> */ - public static void replaceMatchingSeqsWith(List seqs, List annotations, List ochains, + public static List> replaceMatchingSeqsWith( + List seqs, List annotations, + List ochains, AlignmentI al, String dnaOrProtein, boolean removeOldAnnots) { + List orig = new ArrayList(), repl = new ArrayList(); + List aligs = new ArrayList(); if (al != null && al.getHeight() > 0) { ArrayList matches = new ArrayList(); @@ -1108,10 +1116,13 @@ public class AlignSeq if ((q = ochains.indexOf(sp)) > -1) { seqs.set(p, sq = matches.get(q)); + orig.add(sp); + repl.add(sq); sq.setName(sp.getName()); sq.setDescription(sp.getDescription()); Mapping sp2sq; sq.transferAnnotation(sp, sp2sq = aligns.get(q).getMappingFromS1(false)); + aligs.add(aligns.get(q)); int inspos = -1; for (int ap = 0; ap < annotations.size();) { @@ -1142,6 +1153,7 @@ public class AlignSeq } } } + return Arrays.asList(orig, repl, aligs); } /** diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index f267858..34ec2cf 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -21,7 +21,6 @@ package jalview.appletgui; import jalview.analysis.AlignmentSorter; -import jalview.analysis.Conservation; import jalview.api.AlignViewControllerGuiI; import jalview.api.AlignViewControllerI; import jalview.api.SequenceStructureBinding; @@ -56,7 +55,6 @@ import jalview.schemes.PIDColourScheme; import jalview.schemes.PurinePyrimidineColourScheme; import jalview.schemes.RNAHelicesColourChooser; import jalview.schemes.RNAInteractionColourScheme; -import jalview.schemes.ResidueProperties; import jalview.schemes.StrandColourScheme; import jalview.schemes.TCoffeeColourScheme; import jalview.schemes.TaylorColourScheme; @@ -324,7 +322,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, .getKeyCode() >= KeyEvent.VK_NUMPAD0 && evt .getKeyCode() <= KeyEvent.VK_NUMPAD9)) && Character.isDigit(evt.getKeyChar())) + { alignPanel.seqPanel.numberPressed(evt.getKeyChar()); + } switch (evt.getKeyCode()) { @@ -385,16 +385,24 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, case KeyEvent.VK_LEFT: if (evt.isAltDown() || !viewport.cursorMode) + { slideSequences(false, alignPanel.seqPanel.getKeyboardNo1()); + } else + { alignPanel.seqPanel.moveCursor(-1, 0); + } break; case KeyEvent.VK_RIGHT: if (evt.isAltDown() || !viewport.cursorMode) + { slideSequences(true, alignPanel.seqPanel.getKeyboardNo1()); + } else + { alignPanel.seqPanel.moveCursor(1, 0); + } break; case KeyEvent.VK_SPACE: @@ -1257,7 +1265,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, else { if (features == null) + { features = ""; + } } return features; @@ -1573,7 +1583,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, for (int i = 0; i < viewport.getAlignment().getHeight(); i++) { if (!sg.contains(viewport.getAlignment().getSequenceAt(i))) + { invertGroup.addElement(viewport.getAlignment().getSequenceAt(i)); + } } SequenceI[] seqs1 = sg.toArray(new SequenceI[sg.size()]); @@ -1581,30 +1593,44 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, SequenceI[] seqs2 = invertGroup.toArray(new SequenceI[invertGroup .size()]); for (int i = 0; i < invertGroup.size(); i++) + { seqs2[i] = invertGroup.elementAt(i); + } SlideSequencesCommand ssc; if (right) + { ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1, size, viewport.getGapCharacter()); + } else + { ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2, size, viewport.getGapCharacter()); + } int groupAdjustment = 0; if (ssc.getGapsInsertedBegin() && right) { if (viewport.cursorMode) + { alignPanel.seqPanel.moveCursor(size, 0); + } else + { groupAdjustment = size; + } } else if (!ssc.getGapsInsertedBegin() && !right) { if (viewport.cursorMode) + { alignPanel.seqPanel.moveCursor(-size, 0); + } else + { groupAdjustment = -size; + } } if (groupAdjustment != 0) @@ -1625,7 +1651,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } if (!appendHistoryItem) + { addHistoryItem(ssc); + } repaint(); } @@ -3656,6 +3684,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } pdbentry.getProperty().put("protocol", protocol); toaddpdb.addPDBId(pdbentry); + alignPanel.getStructureSelectionManager() + .registerPDBEntry(pdbentry); } } return true; diff --git a/src/jalview/appletgui/RedundancyPanel.java b/src/jalview/appletgui/RedundancyPanel.java index 216f45d..1547862 100644 --- a/src/jalview/appletgui/RedundancyPanel.java +++ b/src/jalview/appletgui/RedundancyPanel.java @@ -213,8 +213,7 @@ public class RedundancyPanel extends SliderPanel implements Runnable, ap.alignFrame.addHistoryItem(cut); PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true); - // ap.av.firePropertyChange("alignment", null, ap.av.getAlignment() - // .getSequences()); + ap.av.firePropertyChange("alignment", null, ap.av.getAlignment().getSequences()); } } @@ -228,6 +227,7 @@ public class RedundancyPanel extends SliderPanel implements Runnable, { ap.av.historyList.removeElement(command); ap.alignFrame.updateEditMenuBar(); + ap.av.firePropertyChange("alignment", null, ap.av.getAlignment().getSequences()); } ap.paintAlignment(true); diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index ef1e16e..0abd31b 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -2076,10 +2076,12 @@ public class JalviewLite extends Applet implements { String sequence = applet.getParameter("PDBSEQ"); if (sequence != null) + { seqs = new SequenceI[] { matcher == null ? (Sequence) newAlignFrame .getAlignViewport().getAlignment() .findName(sequence) : matcher.findIdMatch(sequence) }; + } } else @@ -2139,6 +2141,8 @@ public class JalviewLite extends Applet implements if (seqs[i] != null) { ((Sequence) seqs[i]).addPDBId(pdb); + StructureSelectionManager.getStructureSelectionManager( + applet).registerPDBEntry(pdb); } else { @@ -2323,7 +2327,9 @@ public class JalviewLite extends Applet implements // note separator local variable intentionally masks object field int seplen = separator.length(); if (list == null || list.equals("") || list.equals(separator)) + { return null; + } java.util.Vector jv = new Vector(); int cp = 0, pos; while ((pos = list.indexOf(separator, cp)) > cp) diff --git a/src/jalview/commands/EditCommand.java b/src/jalview/commands/EditCommand.java index 83ba536..5c698a8 100644 --- a/src/jalview/commands/EditCommand.java +++ b/src/jalview/commands/EditCommand.java @@ -20,9 +20,15 @@ */ package jalview.commands; -import java.util.*; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.Annotation; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceI; -import jalview.datamodel.*; +import java.util.Hashtable; +import java.util.List; /** * @@ -215,28 +221,26 @@ public class EditCommand implements CommandI @Override final public void undoCommand(AlignmentI[] views) - { - int e = 0, eSize = edits.length; - for (e = eSize - 1; e > -1; e--) - { - switch (edits[e].command) - { - case INSERT_GAP: - deleteGap(edits[e]); - break; - case DELETE_GAP: - insertGap(edits[e]); - break; - case CUT: - paste(edits[e], views); - break; - case PASTE: - cut(edits[e], views); - break; - case REPLACE: - replace(edits[e]); - break; - } + { + for(Edit e : edits){ + switch (e.command) + { + case INSERT_GAP: + deleteGap(e); + break; + case DELETE_GAP: + insertGap(e); + break; + case CUT: + paste(e, views); + break; + case PASTE: + cut(e, views); + break; + case REPLACE: + replace(e); + break; + } } } @@ -355,7 +359,10 @@ public class EditCommand implements CommandI List sequences; synchronized (sequences = command.al.getSequences()) { - sequences.add(command.alIndex[i], command.seqs[i]); + if (!(command.alIndex[i] < 0)) + { + sequences.add(command.alIndex[i], command.seqs[i]); + } } } else @@ -398,9 +405,13 @@ public class EditCommand implements CommandI + command.number); } if (command.seqs[i].getStart() == start) + { newstart--; + } else + { newend++; + } } } command.string[i] = null; @@ -704,10 +715,12 @@ public class EditCommand implements CommandI { temp = new Annotation[aSize + command.number]; if (annotations[a].padGaps) + { for (int aa = 0; aa < temp.length; aa++) { temp[aa] = new Annotation(command.gapChar + "", null, ' ', 0); } + } } else { @@ -786,8 +799,10 @@ public class EditCommand implements CommandI int copylen = Math.min(command.position, annotations[a].annotations.length); if (copylen > 0) + { System.arraycopy(annotations[a].annotations, 0, temp, 0, copylen); // command.position); + } Annotation[] deleted = new Annotation[command.number]; if (copylen >= command.position) diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index c0d911e..0731991 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -25,8 +25,12 @@ import jalview.analysis.SecStrConsensus.SimpleBP; import jalview.analysis.WUSSParseException; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.Enumeration; +import java.util.HashMap; import java.util.Hashtable; +import java.util.Map; import java.util.Map.Entry; /** @@ -43,17 +47,24 @@ public class AlignmentAnnotation */ public boolean autoCalculated = false; + /** + * unique ID for this annotation, used to match up the same annotation row + * shown in multiple views and alignments + */ public String annotationId; + /** + * the sequence this annotation is associated with (or null) + */ public SequenceI sequenceRef; - /** DOCUMENT ME!! */ + /** label shown in dropdown menus and in the annotation label area */ public String label; - /** DOCUMENT ME!! */ + /** longer description text shown as a tooltip */ public String description; - /** DOCUMENT ME!! */ + /** Array of annotations placed in the current coordinate system */ public Annotation[] annotations; public ArrayList bps = null; @@ -103,6 +114,9 @@ public class AlignmentAnnotation // System.out.println("featuregroup " + _rnasecstr[0].getFeatureGroup()); } + /** + * map of positions in the associated annotation + */ public java.util.Hashtable sequenceMapping; /** DOCUMENT ME!! */ @@ -622,6 +636,14 @@ public class AlignmentAnnotation this.scaleColLabel = annotation.scaleColLabel; this.showAllColLabels = annotation.showAllColLabels; this.calcId = annotation.calcId; + if (annotation.properties!=null) + { + properties = new HashMap(); + for (Map.Entry val:annotation.properties.entrySet()) + { + properties.put(val.getKey(), val.getValue()); + } + } if (this.hasScore = annotation.hasScore) { this.score = annotation.score; @@ -630,9 +652,9 @@ public class AlignmentAnnotation { threshold = new GraphLine(annotation.threshold); } + Annotation[] ann = annotation.annotations; if (annotation.annotations != null) { - Annotation[] ann = annotation.annotations; this.annotations = new Annotation[ann.length]; for (int i = 0; i < ann.length; i++) { @@ -645,24 +667,26 @@ public class AlignmentAnnotation } } } - ; - if (annotation.sequenceRef != null) + } + if (annotation.sequenceRef != null) + { + this.sequenceRef = annotation.sequenceRef; + if (annotation.sequenceMapping != null) { - this.sequenceRef = annotation.sequenceRef; - if (annotation.sequenceMapping != null) + Integer p = null; + sequenceMapping = new Hashtable(); + Enumeration pos = annotation.sequenceMapping.keys(); + while (pos.hasMoreElements()) { - Integer p = null; - sequenceMapping = new Hashtable(); - Enumeration pos = annotation.sequenceMapping.keys(); - while (pos.hasMoreElements()) + // could optimise this! + p = (Integer) pos.nextElement(); + Annotation a = annotation.sequenceMapping.get(p); + if (a == null) + { + continue; + } + if (ann != null) { - // could optimise this! - p = (Integer) pos.nextElement(); - Annotation a = annotation.sequenceMapping.get(p); - if (a == null) - { - continue; - } for (int i = 0; i < ann.length; i++) { if (ann[i] == a) @@ -672,10 +696,10 @@ public class AlignmentAnnotation } } } - else - { - this.sequenceMapping = null; - } + } + else + { + this.sequenceMapping = null; } } // TODO: check if we need to do this: JAL-952 @@ -1119,6 +1143,11 @@ public class AlignmentAnnotation protected String calcId = ""; /** + * properties associated with the calcId + */ + protected Map properties = new HashMap(); + + /** * base colour for line graphs. If null, will be set automatically by * searching the alignment annotation */ @@ -1182,6 +1211,108 @@ public class AlignmentAnnotation // trim positions } } + } + + /** + * like liftOver but more general. + * + * Takes an array of int pairs that will be used to update the internal + * sequenceMapping and so shuffle the annotated positions + * + * @param newref + * - new sequence reference for the annotation row - if null, + * sequenceRef is left unchanged + * @param mapping + * array of ints containing corresponding positions + * @param from + * - column for current coordinate system (-1 for index+1) + * @param to + * - column for destination coordinate system (-1 for index+1) + * @param idxoffset + * - offset added to index when referencing either coordinate system + * @note no checks are made as to whether from and/or to are sensible + * @note caller should add the remapped annotation to newref if they have not + * already + */ + public void remap(SequenceI newref, int[][] mapping, int from, int to, + int idxoffset) + { + if (mapping != null) + { + Hashtable old = sequenceMapping, remap = new Hashtable(); + int index = -1; + for (int mp[] : mapping) + { + if (index++ < 0) + { + continue; + } + Annotation ann = null; + if (from == -1) + { + ann = sequenceMapping.get(Integer.valueOf(idxoffset + index)); + } + else + { + if (mp != null && mp.length > from) + { + ann = sequenceMapping.get(Integer.valueOf(mp[from])); + } + } + if (ann != null) + { + if (to == -1) + { + remap.put(Integer.valueOf(idxoffset + index), ann); + } + else + { + if (to > -1 && to < mp.length) + { + remap.put(Integer.valueOf(mp[to]), ann); + } + } + } + } + sequenceMapping = remap; + old.clear(); + if (newref != null) + { + sequenceRef = newref; + } + adjustForAlignment(); + } + } + + public String getProperty(String property) + { + if (properties == null) + { + return null; + } + return properties.get(property); + } + public void setProperty(String property, String value) + { + if (properties==null) + { + properties = new HashMap(); + } + properties.put(property, value); + } + + public boolean hasProperties() + { + return properties != null && properties.size() > 0; + } + + public Collection getProperties() + { + if (properties == null) + { + return Collections.EMPTY_LIST; + } + return properties.keySet(); } } diff --git a/src/jalview/ext/jmol/PDBFileWithJmol.java b/src/jalview/ext/jmol/PDBFileWithJmol.java index 847453f..159955a 100644 --- a/src/jalview/ext/jmol/PDBFileWithJmol.java +++ b/src/jalview/ext/jmol/PDBFileWithJmol.java @@ -20,6 +20,15 @@ */ package jalview.ext.jmol; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.Annotation; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceI; +import jalview.io.AlignFile; +import jalview.io.FileParse; +import jalview.util.MessageManager; + import java.io.IOException; import java.util.Hashtable; import java.util.Map; @@ -35,15 +44,6 @@ import org.jmol.modelsetbio.BioPolymer; import org.jmol.viewer.Viewer; import org.openscience.jmol.app.JmolApp; -import jalview.datamodel.AlignmentAnnotation; -import jalview.datamodel.Annotation; -import jalview.datamodel.PDBEntry; -import jalview.datamodel.Sequence; -import jalview.datamodel.SequenceI; -import jalview.io.AlignFile; -import jalview.io.FileParse; -import jalview.util.MessageManager; - /** * Import and process PDB files with Jmol * @@ -307,11 +307,16 @@ public class PDBFileWithJmol extends AlignFile implements case MEASURE: String mystatus = (String) data[3]; if (mystatus.indexOf("Picked") >= 0 - || mystatus.indexOf("Sequence") >= 0) // picking mode + || mystatus.indexOf("Sequence") >= 0) + { + // Picking mode sendConsoleMessage(strInfo); + } else if (mystatus.indexOf("Completed") >= 0) + { sendConsoleEcho(strInfo.substring(strInfo.lastIndexOf(",") + 2, strInfo.length() - 1)); + } break; case MESSAGE: sendConsoleMessage(data == null ? null : strInfo); diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index a9eeb12..d4270f9 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -5059,7 +5059,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { PDBEntry pe = new AssociatePdbFileWithSeq() .associatePdbWithSeq((String) fm[0], - (String) fm[1], toassoc, false); + (String) fm[1], toassoc, false, + Desktop.instance); if (pe != null) { System.err.println("Associated file : " diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index 3c552a4..b8996b6 100644 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -22,6 +22,7 @@ package jalview.gui; import jalview.bin.Cache; import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.GraphLine; import jalview.datamodel.SequenceGroup; import jalview.schemes.AnnotationColourGradient; import jalview.schemes.ColourSchemeI; @@ -724,9 +725,19 @@ public class AnnotationColourChooser extends JPanel for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++) { AlignmentAnnotation aa = av.getAlignment().getAlignmentAnnotation()[i]; - if (aa.label.equals(currentAnnotation.label)) + if (aa.label.equals(currentAnnotation.label) + && (currentAnnotation.getCalcId() == null ? aa.getCalcId() == null + : currentAnnotation.getCalcId() + .equals(aa.getCalcId()))) { - aa.threshold.value = thr; + if (aa.threshold == null) + { + aa.threshold = new GraphLine(currentAnnotation.threshold); + } + else + { + aa.threshold.value = thr; + } } } } diff --git a/src/jalview/gui/AssociatePdbFileWithSeq.java b/src/jalview/gui/AssociatePdbFileWithSeq.java index ce75821..a854bdf 100644 --- a/src/jalview/gui/AssociatePdbFileWithSeq.java +++ b/src/jalview/gui/AssociatePdbFileWithSeq.java @@ -20,11 +20,14 @@ */ package jalview.gui; -import javax.swing.JOptionPane; +import jalview.api.StructureSelectionManagerProvider; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; +import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; +import javax.swing.JOptionPane; + /** * GUI related routines for associating PDB files with sequences * @@ -41,46 +44,50 @@ public class AssociatePdbFileWithSeq * @param sequence */ public PDBEntry associatePdbWithSeq(String choice, String protocol, - SequenceI sequence, boolean prompt) + SequenceI sequence, boolean prompt, + StructureSelectionManagerProvider ssmp) { PDBEntry entry = new PDBEntry(); MCview.PDBfile pdbfile = null; - try + pdbfile = StructureSelectionManager.getStructureSelectionManager(ssmp) + .setMapping(false, new SequenceI[] + { sequence }, null, choice, protocol); + if (pdbfile == null) { - // TODO JAL-674 extract secondary structure and transfer it to associated - // sequence - pdbfile = new MCview.PDBfile(false, false, choice, protocol); - if (pdbfile.id == null) - { - String reply = null; - - if (prompt) - { - reply = JOptionPane.showInternalInputDialog(Desktop.desktop, - MessageManager - .getString("label.couldnt_find_pdb_id_in_file"), - MessageManager.getString("label.no_pdb_id_in_file"), - JOptionPane.QUESTION_MESSAGE); - } - if (reply == null) - { - return null; - } + // stacktrace already thrown so just return + return null; + } + if (pdbfile.id == null) + { + String reply = null; - entry.setId(reply); + if (prompt) + { + reply = JOptionPane.showInternalInputDialog(Desktop.desktop, + MessageManager + .getString("label.couldnt_find_pdb_id_in_file"), + MessageManager.getString("label.no_pdb_id_in_file"), + JOptionPane.QUESTION_MESSAGE); } - else + if (reply == null) { - entry.setId(pdbfile.id); + return null; } - } catch (java.io.IOException ex) + entry.setId(reply); + } + else { - ex.printStackTrace(); + entry.setId(pdbfile.id); } - entry.setFile(choice); - sequence.getDatasetSequence().addPDBId(entry); + if (pdbfile != null) + { + entry.setFile(choice); + sequence.getDatasetSequence().addPDBId(entry); + StructureSelectionManager.getStructureSelectionManager(ssmp) + .registerPDBEntry(entry); + } return entry; } } diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 105209f..b608b95 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -20,26 +20,51 @@ */ package jalview.gui; -import java.awt.Rectangle; -import java.io.*; -import java.lang.reflect.InvocationTargetException; -import java.net.*; -import java.util.*; -import java.util.Map.Entry; -import java.util.jar.*; - -import javax.swing.*; - -import org.exolab.castor.xml.*; - import jalview.api.structures.JalviewStructureDisplayI; import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; -import jalview.schemabinding.version2.*; -import jalview.schemes.*; +import jalview.schemabinding.version2.AlcodMap; +import jalview.schemabinding.version2.Alcodon; +import jalview.schemabinding.version2.AlcodonFrame; +import jalview.schemabinding.version2.Annotation; +import jalview.schemabinding.version2.AnnotationColours; +import jalview.schemabinding.version2.AnnotationElement; +import jalview.schemabinding.version2.CalcIdParam; +import jalview.schemabinding.version2.DBRef; +import jalview.schemabinding.version2.Features; +import jalview.schemabinding.version2.Group; +import jalview.schemabinding.version2.HiddenColumns; +import jalview.schemabinding.version2.JGroup; +import jalview.schemabinding.version2.JSeq; +import jalview.schemabinding.version2.JalviewModel; +import jalview.schemabinding.version2.JalviewModelSequence; +import jalview.schemabinding.version2.MapListFrom; +import jalview.schemabinding.version2.MapListTo; +import jalview.schemabinding.version2.Mapping; +import jalview.schemabinding.version2.MappingChoice; +import jalview.schemabinding.version2.OtherData; +import jalview.schemabinding.version2.PdbentryItem; +import jalview.schemabinding.version2.Pdbids; +import jalview.schemabinding.version2.Property; +import jalview.schemabinding.version2.Sequence; +import jalview.schemabinding.version2.SequenceSet; +import jalview.schemabinding.version2.SequenceSetProperties; +import jalview.schemabinding.version2.Setting; +import jalview.schemabinding.version2.StructureState; +import jalview.schemabinding.version2.ThresholdLine; +import jalview.schemabinding.version2.Tree; +import jalview.schemabinding.version2.UserColours; +import jalview.schemabinding.version2.Viewport; +import jalview.schemes.AnnotationColourGradient; +import jalview.schemes.ColourSchemeI; +import jalview.schemes.ColourSchemeProperty; +import jalview.schemes.GraduatedColor; +import jalview.schemes.ResidueColourScheme; +import jalview.schemes.ResidueProperties; +import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.util.jarInputStreamProvider; @@ -51,6 +76,41 @@ import jalview.ws.params.ArgumentI; import jalview.ws.params.AutoCalcSetting; import jalview.ws.params.WsParamSetI; +import java.awt.Rectangle; +import java.io.BufferedReader; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.IdentityHashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map.Entry; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.Vector; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; +import java.util.jar.JarOutputStream; + +import javax.swing.JInternalFrame; +import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; + +import org.exolab.castor.xml.Unmarshaller; + /** * Write out the current jalview desktop state as a Jalview XML stream. * @@ -678,7 +738,9 @@ public class Jalview2XML .startsWith( jmol.jmb.pdbentry[peid].getId() .toLowerCase()))) + { continue; + } if (matchedFile == null) { matchedFile = jmol.jmb.pdbentry[peid].getFile(); @@ -1357,7 +1419,16 @@ public class Jalview2XML calcIdSet.add(aa[i].getCalcId()); an.setCalcId(aa[i].getCalcId()); } - + if (aa[i].hasProperties()) + { + for (String pr : aa[i].getProperties()) + { + Property prop = new Property(); + prop.setName(pr); + prop.setValue(aa[i].getProperty(pr)); + an.addProperty(prop); + } + } AnnotationElement ae; if (aa[i].annotations != null) { @@ -1371,18 +1442,26 @@ public class Jalview2XML ae = new AnnotationElement(); if (aa[i].annotations[a].description != null) + { ae.setDescription(aa[i].annotations[a].description); + } if (aa[i].annotations[a].displayCharacter != null) + { ae.setDisplayCharacter(aa[i].annotations[a].displayCharacter); + } if (!Float.isNaN(aa[i].annotations[a].value)) + { ae.setValue(aa[i].annotations[a].value); + } ae.setPosition(a); if (aa[i].annotations[a].secondaryStructure != ' ' && aa[i].annotations[a].secondaryStructure != '\0') + { ae.setSecondaryStructure(aa[i].annotations[a].secondaryStructure + ""); + } if (aa[i].annotations[a].colour != null && aa[i].annotations[a].colour != java.awt.Color.black) @@ -2046,7 +2125,7 @@ public class Jalview2XML errorMessage = null; } - Hashtable alreadyLoadedPDB; + Hashtable alreadyLoadedPDB; /** * when set, local views will be updated from view stored in JalviewXML @@ -2058,10 +2137,14 @@ public class Jalview2XML String loadPDBFile(jarInputStreamProvider jprovider, String pdbId) { if (alreadyLoadedPDB == null) + { alreadyLoadedPDB = new Hashtable(); + } if (alreadyLoadedPDB.containsKey(pdbId)) + { return alreadyLoadedPDB.get(pdbId).toString(); + } try { @@ -2293,7 +2376,9 @@ public class Jalview2XML entry.setFile(pdbloaded.get(ids[p].getId()).toString()); } } - + StructureSelectionManager.getStructureSelectionManager( + Desktop.instance) + .registerPDBEntry(entry); al.getSequenceAt(i).getDatasetSequence().addPDBId(entry); } } @@ -2409,7 +2494,9 @@ public class Jalview2XML // in principle Visible should always be true for annotation displayed // in multiple views if (an[i].hasVisible()) + { jda.visible = an[i].getVisible(); + } al.addAnnotation(jda); @@ -2428,7 +2515,9 @@ public class Jalview2XML anpos = ae[aa].getPosition(); if (anpos >= anot.length) + { continue; + } anot[anpos] = new jalview.datamodel.Annotation( @@ -2522,10 +2611,14 @@ public class Jalview2XML jaa.setScore(an[i].getScore()); } if (an[i].hasVisible()) + { jaa.visible = an[i].getVisible(); + } if (an[i].hasCentreColLabels()) + { jaa.centreColLabels = an[i].getCentreColLabels(); + } if (an[i].hasScaleColLabels()) { @@ -2547,7 +2640,14 @@ public class Jalview2XML jaa.belowAlignment = an[i].isBelowAlignment(); } jaa.setCalcId(an[i].getCalcId()); - + if (an[i].getPropertyCount() > 0) + { + for (jalview.schemabinding.version2.Property prop : an[i] + .getProperty()) + { + jaa.setProperty(prop.getName(), prop.getValue()); + } + } if (jaa.autoCalculated) { autoAlan.add(new JvAnnotRow(i, jaa)); @@ -3544,12 +3644,16 @@ public class Jalview2XML } renderOrder[fs] = setting.getType(); if (setting.hasOrder()) + { af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setOrder( setting.getType(), setting.getOrder()); + } else + { af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setOrder( setting.getType(), fs / jms.getFeatureSettings().getSettingCount()); + } if (setting.getDisplay()) { af.viewport.featuresDisplayed.put(setting.getType(), new Integer( @@ -4392,7 +4496,9 @@ public class Jalview2XML } } else + { Cache.log.debug("Ignoring " + jvobj.getClass() + " (ID = " + id); + } } } diff --git a/src/jalview/gui/Jalview2XML_V1.java b/src/jalview/gui/Jalview2XML_V1.java index 946181c..9263cd9 100755 --- a/src/jalview/gui/Jalview2XML_V1.java +++ b/src/jalview/gui/Jalview2XML_V1.java @@ -20,18 +20,37 @@ */ package jalview.gui; -import java.io.*; -import java.util.*; -import java.util.jar.*; - -import javax.swing.*; - -import org.exolab.castor.xml.*; -import jalview.binding.*; -import jalview.schemes.*; +import jalview.binding.Annotation; +import jalview.binding.AnnotationElement; +import jalview.binding.Features; +import jalview.binding.JGroup; +import jalview.binding.JSeq; +import jalview.binding.JalviewModel; +import jalview.binding.JalviewModelSequence; +import jalview.binding.Pdbids; +import jalview.binding.Sequence; +import jalview.binding.SequenceSet; +import jalview.binding.Setting; +import jalview.binding.Tree; +import jalview.binding.UserColours; +import jalview.binding.Viewport; +import jalview.schemes.ColourSchemeI; +import jalview.schemes.ColourSchemeProperty; +import jalview.schemes.ResidueProperties; +import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; import jalview.util.jarInputStreamProvider; +import java.io.InputStreamReader; +import java.util.Hashtable; +import java.util.Vector; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; + +import javax.swing.JOptionPane; + +import org.exolab.castor.xml.IDResolver; + /** * DOCUMENT ME! * @@ -120,7 +139,7 @@ public class Jalview2XML_V1 InputStreamReader in = new InputStreamReader(jin, "UTF-8"); JalviewModel object = new JalviewModel(); - object = (JalviewModel) object.unmarshal(in); + object = object.unmarshal(in); af = LoadFromObject(object, file); entryCount++; @@ -222,6 +241,8 @@ public class Jalview2XML_V1 entry.setId(ids[p].getId()); entry.setType(ids[p].getType()); al.getSequenceAt(i).getDatasetSequence().addPDBId(entry); + StructureSelectionManager.getStructureSelectionManager( + Desktop.instance).registerPDBEntry(entry); } } @@ -315,7 +336,7 @@ public class Jalview2XML_V1 for (int s = 0; s < ids.length; s++) { - seqs.addElement((jalview.datamodel.SequenceI) seqids + seqs.addElement(seqids .elementAt(ids[s])); } diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index ad7726d..2845122 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -62,7 +62,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.Hashtable; import java.util.LinkedHashMap; import java.util.List; @@ -190,11 +189,17 @@ public class PopupMenu extends JPopupMenu JMenu outputMenu = new JMenu(); - JMenu showAnnotationsMenu = new JMenu(); + JMenu seqShowAnnotationsMenu = new JMenu(); - JMenu hideAnnotationsMenu = new JMenu(); + JMenu seqHideAnnotationsMenu = new JMenu(); - JMenuItem addReferenceAnnotations = new JMenuItem(); + JMenuItem seqAddReferenceAnnotations = new JMenuItem(); + + JMenu groupShowAnnotationsMenu = new JMenu(); + + JMenu groupHideAnnotationsMenu = new JMenu(); + + JMenuItem groupAddReferenceAnnotations = new JMenuItem(); JMenuItem sequenceFeature = new JMenuItem(); @@ -282,17 +287,26 @@ public class PopupMenu extends JPopupMenu /* * Build menus for annotation types that may be shown or hidden, and for - * 'reference annotations' that may be added to the alignment. The scope is - * annotations for the current selection group (if there is one), else the - * current sequence (if there is one), else not applicable (e.g. for popup - * menu within the sequence). + * 'reference annotations' that may be added to the alignment. First for the + * currently selected sequence (if there is one): */ - final List sequenceScope = getSequenceScope(seq); - if (!sequenceScope.isEmpty()) - { - buildAnnotationTypesMenus(sequenceScope); - configureReferenceAnnotationsMenu(addReferenceAnnotations, sequenceScope); - } + final List selectedSequence = (seq == null ? Collections + . emptyList() : Arrays.asList(seq)); + buildAnnotationTypesMenus(seqShowAnnotationsMenu, + seqHideAnnotationsMenu, selectedSequence); + configureReferenceAnnotationsMenu(seqAddReferenceAnnotations, + selectedSequence); + + /* + * And repeat for the current selection group (if there is one): + */ + final List selectedGroup = (ap.av.getSelectionGroup() == null ? Collections + . emptyList() : ap.av.getSelectionGroup() + .getSequences()); + buildAnnotationTypesMenus(groupShowAnnotationsMenu, + groupHideAnnotationsMenu, selectedGroup); + configureReferenceAnnotationsMenu(groupAddReferenceAnnotations, + selectedGroup); try { @@ -809,9 +823,10 @@ public class PopupMenu extends JPopupMenu } /** - * Add annotation types to a 'Show annotations' or 'Hide annotations' menu. + * Add annotation types to 'Show annotations' and/or 'Hide annotations' menus. * "All" is added first, followed by a separator. Then add any annotation - * types associated with the current selection. + * types associated with the current selection. Separate menus are built for + * the selected sequence group (if any), and the selected sequence. *

* Some annotation rows are always rendered together - these can be identified * by a common graphGroup property > -1. Only one of each group will be marked @@ -820,29 +835,32 @@ public class PopupMenu extends JPopupMenu *

* IUPredWS (Long), IUPredWS (Short) * - * @param forSequences + * @param seq */ - protected void buildAnnotationTypesMenus(List forSequences) + protected void buildAnnotationTypesMenus(JMenu showMenu, JMenu hideMenu, + List forSequences) { - showAnnotationsMenu.removeAll(); - hideAnnotationsMenu.removeAll(); + showMenu.removeAll(); + hideMenu.removeAll(); + final List all = Arrays.asList(ALL_ANNOTATIONS); - addAnnotationTypeToShowHide(showAnnotationsMenu, forSequences, "", all, - true, true); - addAnnotationTypeToShowHide(hideAnnotationsMenu, forSequences, "", all, - true, false); - showAnnotationsMenu.addSeparator(); - hideAnnotationsMenu.addSeparator(); + addAnnotationTypeToShowHide(showMenu, forSequences, "", all, true, true); + addAnnotationTypeToShowHide(hideMenu, forSequences, "", all, true, + false); + showMenu.addSeparator(); + hideMenu.addSeparator(); final AlignmentAnnotation[] annotations = ap.getAlignment() .getAlignmentAnnotation(); /* * Find shown/hidden annotations types, distinguished by source (calcId), - * and grouped by graphGroup. + * and grouped by graphGroup. Using LinkedHashMap means we will retrieve in + * the insertion order, which is the order of the annotations on the + * alignment. */ - Map>> shownTypes = new HashMap>>(); - Map>> hiddenTypes = new HashMap>>(); + Map>> shownTypes = new LinkedHashMap>>(); + Map>> hiddenTypes = new LinkedHashMap>>(); AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, hiddenTypes, AlignmentAnnotationUtils.asList(annotations), @@ -852,23 +870,23 @@ public class PopupMenu extends JPopupMenu { for (List type : hiddenTypes.get(calcId)) { - addAnnotationTypeToShowHide(showAnnotationsMenu, forSequences, + addAnnotationTypeToShowHide(showMenu, forSequences, calcId, type, false, true); } } // grey out 'show annotations' if none are hidden - showAnnotationsMenu.setEnabled(!hiddenTypes.isEmpty()); + showMenu.setEnabled(!hiddenTypes.isEmpty()); for (String calcId : shownTypes.keySet()) { for (List type : shownTypes.get(calcId)) { - addAnnotationTypeToShowHide(hideAnnotationsMenu, forSequences, + addAnnotationTypeToShowHide(hideMenu, forSequences, calcId, type, false, false); } } // grey out 'hide annotations' if none are shown - hideAnnotationsMenu.setEnabled(!shownTypes.isEmpty()); + hideMenu.setEnabled(!shownTypes.isEmpty()); } /** @@ -1445,9 +1463,13 @@ public class PopupMenu extends JPopupMenu }); outputMenu.setText(MessageManager.getString("label.out_to_textbox") + "..."); - showAnnotationsMenu.setText(MessageManager + seqShowAnnotationsMenu.setText(MessageManager .getString("label.show_annotations")); - hideAnnotationsMenu.setText(MessageManager + seqHideAnnotationsMenu.setText(MessageManager + .getString("label.hide_annotations")); + groupShowAnnotationsMenu.setText(MessageManager + .getString("label.show_annotations")); + groupHideAnnotationsMenu.setText(MessageManager .getString("label.hide_annotations")); sequenceFeature.setText(MessageManager .getString("label.create_sequence_feature")); @@ -1498,22 +1520,15 @@ public class PopupMenu extends JPopupMenu // groupMenu.add(chooseAnnotations); /* - * Add show/hide annotations to either Selection menu (if a selection group - * in force), else to the Sequence menu. + * Add show/hide annotations to the Sequence menu, and to the Selection menu + * (if a selection group is in force). */ - SequenceGroup sg = this.ap.av.getSelectionGroup(); - if (sg != null && sg.getSize() > 0) - { - groupMenu.add(showAnnotationsMenu); - groupMenu.add(hideAnnotationsMenu); - groupMenu.add(addReferenceAnnotations); - } - else - { - sequenceMenu.add(showAnnotationsMenu); - sequenceMenu.add(hideAnnotationsMenu); - sequenceMenu.add(addReferenceAnnotations); - } + sequenceMenu.add(seqShowAnnotationsMenu); + sequenceMenu.add(seqHideAnnotationsMenu); + sequenceMenu.add(seqAddReferenceAnnotations); + groupMenu.add(groupShowAnnotationsMenu); + groupMenu.add(groupHideAnnotationsMenu); + groupMenu.add(groupAddReferenceAnnotations); groupMenu.add(editMenu); groupMenu.add(outputMenu); groupMenu.add(sequenceFeature); @@ -2552,7 +2567,8 @@ public class PopupMenu extends JPopupMenu String choice = chooser.getSelectedFile().getPath(); jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice); new AssociatePdbFileWithSeq().associatePdbWithSeq(choice, - jalview.io.AppletFormatAdapter.FILE, sequence, true); + jalview.io.AppletFormatAdapter.FILE, sequence, true, + Desktop.instance); } } diff --git a/src/jalview/gui/RedundancyPanel.java b/src/jalview/gui/RedundancyPanel.java index 1fcd875..0e55cf8 100755 --- a/src/jalview/gui/RedundancyPanel.java +++ b/src/jalview/gui/RedundancyPanel.java @@ -245,8 +245,7 @@ public class RedundancyPanel extends GSliderPanel implements Runnable ap.alignFrame.addHistoryItem(cut); PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true); - // ap.av.firePropertyChange("alignment", null, ap.av.getAlignment() - // .getSequences()); + ap.av.firePropertyChange("alignment", null, ap.av.getAlignment().getSequences()); } } @@ -259,12 +258,17 @@ public class RedundancyPanel extends GSliderPanel implements Runnable */ public void undoButton_actionPerformed(ActionEvent e) { + if(historyList == null || historyList.isEmpty()){ + undoButton.setEnabled(false); + return; + } + CommandI command = (CommandI) historyList.pop(); - command.undoCommand(af.getViewAlignments()); - if (ap.av.historyList.contains(command)) { + command.undoCommand(af.getViewAlignments()); ap.av.historyList.remove(command); + ap.av.firePropertyChange("alignment", null, ap.av.getAlignment().getSequences()); af.updateEditMenuBar(); } diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 0f94efa..82b94c3 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -21,15 +21,19 @@ package jalview.io; import jalview.datamodel.AlignmentI; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; import jalview.gui.AlignViewport; import jalview.gui.Desktop; import jalview.gui.Jalview2XML; +import jalview.structure.StructureSelectionManager; +import jalview.util.MessageManager; +import java.util.List; import java.util.StringTokenizer; import java.util.Vector; -import jalview.util.MessageManager; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; @@ -310,6 +314,21 @@ public class FileLoader implements Runnable if ((al != null) && (al.getHeight() > 0)) { + for (SequenceI sq : al.getSequences()) + { + while (sq.getDatasetSequence() != null) + { + sq = sq.getDatasetSequence(); + } + if (sq.getPDBId() != null) + { + for (PDBEntry pdbe : (List) sq.getPDBId()) + { + StructureSelectionManager.getStructureSelectionManager( + Desktop.instance).registerPDBEntry(pdbe); + } + } + } if (viewport != null) { // TODO: create undo object for this JAL-1101 @@ -319,7 +338,6 @@ public class FileLoader implements Runnable } viewport.firePropertyChange("alignment", null, viewport .getAlignment().getSequences()); - } else { @@ -331,7 +349,9 @@ public class FileLoader implements Runnable { title })); if (!protocol.equals(AppletFormatAdapter.PASTE)) + { alignFrame.setFileName(file, format); + } if (raiseGUI) { // add the window to the GUI diff --git a/src/jalview/schemabinding/version2/.castor.cdr b/src/jalview/schemabinding/version2/.castor.cdr index 425a30a..99f61ea 100644 --- a/src/jalview/schemabinding/version2/.castor.cdr +++ b/src/jalview/schemabinding/version2/.castor.cdr @@ -1,4 +1,4 @@ -#Thu May 01 17:34:18 BST 2014 +#Fri Oct 31 16:47:51 GMT 2014 jalview.schemabinding.version2.ThresholdLine=jalview.schemabinding.version2.descriptors.ThresholdLineDescriptor jalview.schemabinding.version2.SequenceSetProperties=jalview.schemabinding.version2.descriptors.SequenceSetPropertiesDescriptor jalview.schemabinding.version2.StructureState=jalview.schemabinding.version2.descriptors.StructureStateDescriptor diff --git a/src/jalview/schemabinding/version2/Annotation.java b/src/jalview/schemabinding/version2/Annotation.java index 0741387..3da8552 100644 --- a/src/jalview/schemabinding/version2/Annotation.java +++ b/src/jalview/schemabinding/version2/Annotation.java @@ -1,30 +1,15 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) - * Copyright (C) 2014 The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.schemabinding.version2; + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ -//- Imported classes and packages -/ -//---------------------------------/ - -import jalview.util.MessageManager; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; @@ -34,1211 +19,1329 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class Annotation implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _graph. - */ - private boolean _graph; - - /** - * keeps track of state for field: _graph - */ - private boolean _has_graph; - - /** - * Field _graphType. - */ - private int _graphType; - - /** - * keeps track of state for field: _graphType - */ - private boolean _has_graphType; - - /** - * Field _sequenceRef. - */ - private java.lang.String _sequenceRef; - - /** - * Field _groupRef. - */ - private java.lang.String _groupRef; - - /** - * Field _graphColour. - */ - private int _graphColour; - - /** - * keeps track of state for field: _graphColour - */ - private boolean _has_graphColour; - - /** - * Field _graphGroup. - */ - private int _graphGroup; - - /** - * keeps track of state for field: _graphGroup - */ - private boolean _has_graphGroup; - - /** - * height in pixels for the graph if this is a graph-type annotation. - */ - private int _graphHeight; - - /** - * keeps track of state for field: _graphHeight - */ - private boolean _has_graphHeight; - - /** - * Field _id. - */ - private java.lang.String _id; - - /** - * Field _scoreOnly. - */ - private boolean _scoreOnly = false; - - /** - * keeps track of state for field: _scoreOnly - */ - private boolean _has_scoreOnly; - - /** - * Field _score. - */ - private double _score; - - /** - * keeps track of state for field: _score - */ - private boolean _has_score; - - /** - * Field _visible. - */ - private boolean _visible; - - /** - * keeps track of state for field: _visible - */ - private boolean _has_visible; - - /** - * Field _centreColLabels. - */ - private boolean _centreColLabels; - - /** - * keeps track of state for field: _centreColLabels - */ - private boolean _has_centreColLabels; - - /** - * Field _scaleColLabels. - */ - private boolean _scaleColLabels; - - /** - * keeps track of state for field: _scaleColLabels - */ - private boolean _has_scaleColLabels; - - /** - * Field _showAllColLabels. - */ - private boolean _showAllColLabels; - - /** - * keeps track of state for field: _showAllColLabels - */ - private boolean _has_showAllColLabels; - - /** - * is an autocalculated annotation row - */ - private boolean _autoCalculated = false; - - /** - * keeps track of state for field: _autoCalculated - */ - private boolean _has_autoCalculated; - - /** - * is to be shown below the alignment - introduced in Jalview 2.8 for - * visualizing T-COFFEE alignment scores - */ - private boolean _belowAlignment = true; - - /** - * keeps track of state for field: _belowAlignment - */ - private boolean _has_belowAlignment; - - /** - * Optional string identifier used to group sets of annotation produced by a - * particular calculation. Values are opaque strings but have semantic meaning - * to Jalview's renderer, data importer and calculation system. - */ - private java.lang.String _calcId; - - /** - * Field _annotationElementList. - */ - private java.util.Vector _annotationElementList; - - /** - * Field _label. - */ - private java.lang.String _label; - - /** - * Field _description. - */ - private java.lang.String _description; - - /** - * Field _thresholdLine. - */ - private jalview.schemabinding.version2.ThresholdLine _thresholdLine; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public Annotation() - { - super(); - this._annotationElementList = new java.util.Vector(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * - * - * @param vAnnotationElement - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addAnnotationElement( - final jalview.schemabinding.version2.AnnotationElement vAnnotationElement) - throws java.lang.IndexOutOfBoundsException - { - this._annotationElementList.addElement(vAnnotationElement); - } - - /** - * - * - * @param index - * @param vAnnotationElement - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void addAnnotationElement( - final int index, - final jalview.schemabinding.version2.AnnotationElement vAnnotationElement) - throws java.lang.IndexOutOfBoundsException - { - this._annotationElementList.add(index, vAnnotationElement); - } - - /** - */ - public void deleteAutoCalculated() - { - this._has_autoCalculated = false; - } - - /** - */ - public void deleteBelowAlignment() - { - this._has_belowAlignment = false; - } - - /** - */ - public void deleteCentreColLabels() - { - this._has_centreColLabels = false; - } - - /** - */ - public void deleteGraph() - { - this._has_graph = false; - } - - /** - */ - public void deleteGraphColour() - { - this._has_graphColour = false; - } - - /** - */ - public void deleteGraphGroup() - { - this._has_graphGroup = false; - } - - /** - */ - public void deleteGraphHeight() - { - this._has_graphHeight = false; - } - - /** - */ - public void deleteGraphType() - { - this._has_graphType = false; - } - - /** - */ - public void deleteScaleColLabels() - { - this._has_scaleColLabels = false; - } - - /** - */ - public void deleteScore() - { - this._has_score = false; - } - - /** - */ - public void deleteScoreOnly() - { - this._has_scoreOnly = false; - } - - /** - */ - public void deleteShowAllColLabels() - { - this._has_showAllColLabels = false; - } - - /** - */ - public void deleteVisible() - { - this._has_visible = false; - } - - /** - * Method enumerateAnnotationElement. - * - * @return an Enumeration over all - * jalview.schemabinding.version2.AnnotationElement elements - */ - public java.util.Enumeration enumerateAnnotationElement() - { - return this._annotationElementList.elements(); - } - - /** - * Method getAnnotationElement. - * - * @param index - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - * @return the value of the jalview.schemabinding.version2.AnnotationElement - * at the given index - */ - public jalview.schemabinding.version2.AnnotationElement getAnnotationElement( - final int index) throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._annotationElementList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "getAnnotationElement", - Integer.valueOf(index).toString(), - Integer.valueOf((this._annotationElementList.size() - 1)).toString() - })); - } - - return (jalview.schemabinding.version2.AnnotationElement) _annotationElementList - .get(index); - } - - /** - * Method getAnnotationElement.Returns the contents of the collection in an - * Array. - *

- * Note: Just in case the collection contents are changing in another thread, - * we pass a 0-length Array of the correct type into the API call. This way we - * know that the Array returned is of exactly the correct length. - * - * @return this collection as an Array - */ - public jalview.schemabinding.version2.AnnotationElement[] getAnnotationElement() - { - jalview.schemabinding.version2.AnnotationElement[] array = new jalview.schemabinding.version2.AnnotationElement[0]; - return (jalview.schemabinding.version2.AnnotationElement[]) this._annotationElementList - .toArray(array); - } - - /** - * Method getAnnotationElementCount. - * - * @return the size of this collection - */ - public int getAnnotationElementCount() - { - return this._annotationElementList.size(); - } - - /** - * Returns the value of field 'autoCalculated'. The field 'autoCalculated' has - * the following description: is an autocalculated annotation row - * - * @return the value of field 'AutoCalculated'. - */ - public boolean getAutoCalculated() - { - return this._autoCalculated; - } - - /** - * Returns the value of field 'belowAlignment'. The field 'belowAlignment' has - * the following description: is to be shown below the alignment - introduced - * in Jalview 2.8 for visualizing T-COFFEE alignment scores - * - * @return the value of field 'BelowAlignment'. - */ - public boolean getBelowAlignment() - { - return this._belowAlignment; - } - - /** - * Returns the value of field 'calcId'. The field 'calcId' has the following - * description: Optional string identifier used to group sets of annotation - * produced by a particular calculation. Values are opaque strings but have - * semantic meaning to Jalview's renderer, data importer and calculation - * system. - * - * @return the value of field 'CalcId'. - */ - public java.lang.String getCalcId() - { - return this._calcId; - } - - /** - * Returns the value of field 'centreColLabels'. - * - * @return the value of field 'CentreColLabels'. - */ - public boolean getCentreColLabels() - { - return this._centreColLabels; - } - - /** - * Returns the value of field 'description'. - * - * @return the value of field 'Description'. - */ - public java.lang.String getDescription() - { - return this._description; - } - - /** - * Returns the value of field 'graph'. - * - * @return the value of field 'Graph'. - */ - public boolean getGraph() - { - return this._graph; - } - - /** - * Returns the value of field 'graphColour'. - * - * @return the value of field 'GraphColour'. - */ - public int getGraphColour() - { - return this._graphColour; - } - - /** - * Returns the value of field 'graphGroup'. - * - * @return the value of field 'GraphGroup'. - */ - public int getGraphGroup() - { - return this._graphGroup; - } - - /** - * Returns the value of field 'graphHeight'. The field 'graphHeight' has the - * following description: height in pixels for the graph if this is a - * graph-type annotation. - * - * @return the value of field 'GraphHeight'. - */ - public int getGraphHeight() - { - return this._graphHeight; - } - - /** - * Returns the value of field 'graphType'. - * - * @return the value of field 'GraphType'. - */ - public int getGraphType() - { - return this._graphType; - } - - /** - * Returns the value of field 'groupRef'. - * - * @return the value of field 'GroupRef'. - */ - public java.lang.String getGroupRef() - { - return this._groupRef; - } - - /** - * Returns the value of field 'id'. - * - * @return the value of field 'Id'. - */ - public java.lang.String getId() - { - return this._id; - } - - /** - * Returns the value of field 'label'. - * - * @return the value of field 'Label'. - */ - public java.lang.String getLabel() - { - return this._label; - } - - /** - * Returns the value of field 'scaleColLabels'. - * - * @return the value of field 'ScaleColLabels'. - */ - public boolean getScaleColLabels() - { - return this._scaleColLabels; - } - - /** - * Returns the value of field 'score'. - * - * @return the value of field 'Score'. - */ - public double getScore() - { - return this._score; - } - - /** - * Returns the value of field 'scoreOnly'. - * - * @return the value of field 'ScoreOnly'. - */ - public boolean getScoreOnly() - { - return this._scoreOnly; - } - - /** - * Returns the value of field 'sequenceRef'. - * - * @return the value of field 'SequenceRef'. - */ - public java.lang.String getSequenceRef() - { - return this._sequenceRef; - } - - /** - * Returns the value of field 'showAllColLabels'. - * - * @return the value of field 'ShowAllColLabels'. - */ - public boolean getShowAllColLabels() - { - return this._showAllColLabels; - } - - /** - * Returns the value of field 'thresholdLine'. - * - * @return the value of field 'ThresholdLine'. - */ - public jalview.schemabinding.version2.ThresholdLine getThresholdLine() - { - return this._thresholdLine; - } - - /** - * Returns the value of field 'visible'. - * - * @return the value of field 'Visible'. - */ - public boolean getVisible() - { - return this._visible; - } - - /** - * Method hasAutoCalculated. - * - * @return true if at least one AutoCalculated has been added - */ - public boolean hasAutoCalculated() - { - return this._has_autoCalculated; - } - - /** - * Method hasBelowAlignment. - * - * @return true if at least one BelowAlignment has been added - */ - public boolean hasBelowAlignment() - { - return this._has_belowAlignment; - } - - /** - * Method hasCentreColLabels. - * - * @return true if at least one CentreColLabels has been added - */ - public boolean hasCentreColLabels() - { - return this._has_centreColLabels; - } - - /** - * Method hasGraph. - * - * @return true if at least one Graph has been added - */ - public boolean hasGraph() - { - return this._has_graph; - } - - /** - * Method hasGraphColour. - * - * @return true if at least one GraphColour has been added - */ - public boolean hasGraphColour() - { - return this._has_graphColour; - } - - /** - * Method hasGraphGroup. - * - * @return true if at least one GraphGroup has been added - */ - public boolean hasGraphGroup() - { - return this._has_graphGroup; - } - - /** - * Method hasGraphHeight. - * - * @return true if at least one GraphHeight has been added - */ - public boolean hasGraphHeight() - { - return this._has_graphHeight; - } - - /** - * Method hasGraphType. - * - * @return true if at least one GraphType has been added - */ - public boolean hasGraphType() - { - return this._has_graphType; - } - - /** - * Method hasScaleColLabels. - * - * @return true if at least one ScaleColLabels has been added - */ - public boolean hasScaleColLabels() - { - return this._has_scaleColLabels; - } - - /** - * Method hasScore. - * - * @return true if at least one Score has been added - */ - public boolean hasScore() - { - return this._has_score; - } - - /** - * Method hasScoreOnly. - * - * @return true if at least one ScoreOnly has been added - */ - public boolean hasScoreOnly() - { - return this._has_scoreOnly; - } - - /** - * Method hasShowAllColLabels. - * - * @return true if at least one ShowAllColLabels has been added - */ - public boolean hasShowAllColLabels() - { - return this._has_showAllColLabels; - } - - /** - * Method hasVisible. - * - * @return true if at least one Visible has been added - */ - public boolean hasVisible() - { - return this._has_visible; - } - - /** - * Returns the value of field 'autoCalculated'. The field 'autoCalculated' has - * the following description: is an autocalculated annotation row - * - * @return the value of field 'AutoCalculated'. - */ - public boolean isAutoCalculated() - { - return this._autoCalculated; - } - - /** - * Returns the value of field 'belowAlignment'. The field 'belowAlignment' has - * the following description: is to be shown below the alignment - introduced - * in Jalview 2.8 for visualizing T-COFFEE alignment scores - * - * @return the value of field 'BelowAlignment'. - */ - public boolean isBelowAlignment() - { - return this._belowAlignment; - } - - /** - * Returns the value of field 'centreColLabels'. - * - * @return the value of field 'CentreColLabels'. - */ - public boolean isCentreColLabels() - { - return this._centreColLabels; - } - - /** - * Returns the value of field 'graph'. - * - * @return the value of field 'Graph'. - */ - public boolean isGraph() - { - return this._graph; - } - - /** - * Returns the value of field 'scaleColLabels'. - * - * @return the value of field 'ScaleColLabels'. - */ - public boolean isScaleColLabels() - { - return this._scaleColLabels; - } - - /** - * Returns the value of field 'scoreOnly'. - * - * @return the value of field 'ScoreOnly'. - */ - public boolean isScoreOnly() - { - return this._scoreOnly; - } - - /** - * Returns the value of field 'showAllColLabels'. - * - * @return the value of field 'ShowAllColLabels'. - */ - public boolean isShowAllColLabels() - { - return this._showAllColLabels; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; - } - return true; - } - - /** - * Returns the value of field 'visible'. - * - * @return the value of field 'Visible'. - */ - public boolean isVisible() - { - return this._visible; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - */ - public void removeAllAnnotationElement() - { - this._annotationElementList.clear(); - } - - /** - * Method removeAnnotationElement. - * - * @param vAnnotationElement - * @return true if the object was removed from the collection. - */ - public boolean removeAnnotationElement( - final jalview.schemabinding.version2.AnnotationElement vAnnotationElement) - { - boolean removed = _annotationElementList.remove(vAnnotationElement); - return removed; - } - - /** - * Method removeAnnotationElementAt. - * - * @param index - * @return the element removed from the collection - */ - public jalview.schemabinding.version2.AnnotationElement removeAnnotationElementAt( - final int index) - { - java.lang.Object obj = this._annotationElementList.remove(index); - return (jalview.schemabinding.version2.AnnotationElement) obj; - } - - /** - * - * - * @param index - * @param vAnnotationElement - * @throws java.lang.IndexOutOfBoundsException - * if the index given is outside the bounds of the collection - */ - public void setAnnotationElement( - final int index, - final jalview.schemabinding.version2.AnnotationElement vAnnotationElement) - throws java.lang.IndexOutOfBoundsException - { - // check bounds for index - if (index < 0 || index >= this._annotationElementList.size()) - { - throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{ - "setAnnotationElement", - Integer.valueOf(index).toString(), - Integer.valueOf((this._annotationElementList.size() - 1)).toString() - })); - } - - this._annotationElementList.set(index, vAnnotationElement); - } - - /** - * - * - * @param vAnnotationElementArray - */ - public void setAnnotationElement( - final jalview.schemabinding.version2.AnnotationElement[] vAnnotationElementArray) - { - // -- copy array - _annotationElementList.clear(); - - for (int i = 0; i < vAnnotationElementArray.length; i++) - { - this._annotationElementList.add(vAnnotationElementArray[i]); - } - } - - /** - * Sets the value of field 'autoCalculated'. The field 'autoCalculated' has - * the following description: is an autocalculated annotation row - * - * @param autoCalculated - * the value of field 'autoCalculated'. - */ - public void setAutoCalculated(final boolean autoCalculated) - { - this._autoCalculated = autoCalculated; - this._has_autoCalculated = true; - } - - /** - * Sets the value of field 'belowAlignment'. The field 'belowAlignment' has - * the following description: is to be shown below the alignment - introduced - * in Jalview 2.8 for visualizing T-COFFEE alignment scores - * - * @param belowAlignment - * the value of field 'belowAlignment'. - */ - public void setBelowAlignment(final boolean belowAlignment) - { - this._belowAlignment = belowAlignment; - this._has_belowAlignment = true; - } - - /** - * Sets the value of field 'calcId'. The field 'calcId' has the following - * description: Optional string identifier used to group sets of annotation - * produced by a particular calculation. Values are opaque strings but have - * semantic meaning to Jalview's renderer, data importer and calculation - * system. - * - * @param calcId - * the value of field 'calcId'. - */ - public void setCalcId(final java.lang.String calcId) - { - this._calcId = calcId; - } - - /** - * Sets the value of field 'centreColLabels'. - * - * @param centreColLabels - * the value of field 'centreColLabels'. - */ - public void setCentreColLabels(final boolean centreColLabels) - { - this._centreColLabels = centreColLabels; - this._has_centreColLabels = true; - } - - /** - * Sets the value of field 'description'. - * - * @param description - * the value of field 'description'. - */ - public void setDescription(final java.lang.String description) - { - this._description = description; - } - - /** - * Sets the value of field 'graph'. - * - * @param graph - * the value of field 'graph'. - */ - public void setGraph(final boolean graph) - { - this._graph = graph; - this._has_graph = true; - } - - /** - * Sets the value of field 'graphColour'. - * - * @param graphColour - * the value of field 'graphColour'. - */ - public void setGraphColour(final int graphColour) - { - this._graphColour = graphColour; - this._has_graphColour = true; - } - - /** - * Sets the value of field 'graphGroup'. - * - * @param graphGroup - * the value of field 'graphGroup'. - */ - public void setGraphGroup(final int graphGroup) - { - this._graphGroup = graphGroup; - this._has_graphGroup = true; - } - - /** - * Sets the value of field 'graphHeight'. The field 'graphHeight' has the - * following description: height in pixels for the graph if this is a - * graph-type annotation. - * - * @param graphHeight - * the value of field 'graphHeight'. - */ - public void setGraphHeight(final int graphHeight) - { - this._graphHeight = graphHeight; - this._has_graphHeight = true; - } - - /** - * Sets the value of field 'graphType'. - * - * @param graphType - * the value of field 'graphType'. - */ - public void setGraphType(final int graphType) - { - this._graphType = graphType; - this._has_graphType = true; - } - - /** - * Sets the value of field 'groupRef'. - * - * @param groupRef - * the value of field 'groupRef'. - */ - public void setGroupRef(final java.lang.String groupRef) - { - this._groupRef = groupRef; - } - - /** - * Sets the value of field 'id'. - * - * @param id - * the value of field 'id'. - */ - public void setId(final java.lang.String id) - { - this._id = id; - } - - /** - * Sets the value of field 'label'. - * - * @param label - * the value of field 'label'. - */ - public void setLabel(final java.lang.String label) - { - this._label = label; - } - - /** - * Sets the value of field 'scaleColLabels'. - * - * @param scaleColLabels - * the value of field 'scaleColLabels'. - */ - public void setScaleColLabels(final boolean scaleColLabels) - { - this._scaleColLabels = scaleColLabels; - this._has_scaleColLabels = true; - } - - /** - * Sets the value of field 'score'. - * - * @param score - * the value of field 'score'. - */ - public void setScore(final double score) - { - this._score = score; - this._has_score = true; - } - - /** - * Sets the value of field 'scoreOnly'. - * - * @param scoreOnly - * the value of field 'scoreOnly'. - */ - public void setScoreOnly(final boolean scoreOnly) - { - this._scoreOnly = scoreOnly; - this._has_scoreOnly = true; - } - - /** - * Sets the value of field 'sequenceRef'. - * - * @param sequenceRef - * the value of field 'sequenceRef'. - */ - public void setSequenceRef(final java.lang.String sequenceRef) - { - this._sequenceRef = sequenceRef; - } - - /** - * Sets the value of field 'showAllColLabels'. - * - * @param showAllColLabels - * the value of field 'showAllColLabels' - */ - public void setShowAllColLabels(final boolean showAllColLabels) - { - this._showAllColLabels = showAllColLabels; - this._has_showAllColLabels = true; - } - - /** - * Sets the value of field 'thresholdLine'. - * - * @param thresholdLine - * the value of field 'thresholdLine'. - */ - public void setThresholdLine( - final jalview.schemabinding.version2.ThresholdLine thresholdLine) - { - this._thresholdLine = thresholdLine; - } - - /** - * Sets the value of field 'visible'. - * - * @param visible - * the value of field 'visible'. - */ - public void setVisible(final boolean visible) - { - this._visible = visible; - this._has_visible = true; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.schemabinding.version2.Annotation - */ - public static jalview.schemabinding.version2.Annotation unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.schemabinding.version2.Annotation) Unmarshaller - .unmarshal(jalview.schemabinding.version2.Annotation.class, - reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } +public class Annotation implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _graph. + */ + private boolean _graph; + + /** + * keeps track of state for field: _graph + */ + private boolean _has_graph; + + /** + * Field _graphType. + */ + private int _graphType; + + /** + * keeps track of state for field: _graphType + */ + private boolean _has_graphType; + + /** + * Field _sequenceRef. + */ + private java.lang.String _sequenceRef; + + /** + * Field _groupRef. + */ + private java.lang.String _groupRef; + + /** + * Field _graphColour. + */ + private int _graphColour; + + /** + * keeps track of state for field: _graphColour + */ + private boolean _has_graphColour; + + /** + * Field _graphGroup. + */ + private int _graphGroup; + + /** + * keeps track of state for field: _graphGroup + */ + private boolean _has_graphGroup; + + /** + * height in pixels for the graph if this is a graph-type + * annotation. + */ + private int _graphHeight; + + /** + * keeps track of state for field: _graphHeight + */ + private boolean _has_graphHeight; + + /** + * Field _id. + */ + private java.lang.String _id; + + /** + * Field _scoreOnly. + */ + private boolean _scoreOnly = false; + + /** + * keeps track of state for field: _scoreOnly + */ + private boolean _has_scoreOnly; + + /** + * Field _score. + */ + private double _score; + + /** + * keeps track of state for field: _score + */ + private boolean _has_score; + + /** + * Field _visible. + */ + private boolean _visible; + + /** + * keeps track of state for field: _visible + */ + private boolean _has_visible; + + /** + * Field _centreColLabels. + */ + private boolean _centreColLabels; + + /** + * keeps track of state for field: _centreColLabels + */ + private boolean _has_centreColLabels; + + /** + * Field _scaleColLabels. + */ + private boolean _scaleColLabels; + + /** + * keeps track of state for field: _scaleColLabels + */ + private boolean _has_scaleColLabels; + + /** + * Field _showAllColLabels. + */ + private boolean _showAllColLabels; + + /** + * keeps track of state for field: _showAllColLabels + */ + private boolean _has_showAllColLabels; + + /** + * is an autocalculated annotation row + */ + private boolean _autoCalculated = false; + + /** + * keeps track of state for field: _autoCalculated + */ + private boolean _has_autoCalculated; + + /** + * is to be shown below the alignment - introduced in Jalview + * 2.8 for visualizing T-COFFEE alignment scores + */ + private boolean _belowAlignment = true; + + /** + * keeps track of state for field: _belowAlignment + */ + private boolean _has_belowAlignment; + + /** + * Optional string identifier used to group sets of annotation + * produced by a particular calculation. Values are opaque + * strings but have semantic meaning to Jalview's renderer, + * data importer and calculation system. + */ + private java.lang.String _calcId; + + /** + * Field _annotationElementList. + */ + private java.util.Vector _annotationElementList; + + /** + * Field _label. + */ + private java.lang.String _label; + + /** + * Field _description. + */ + private java.lang.String _description; + + /** + * Field _thresholdLine. + */ + private jalview.schemabinding.version2.ThresholdLine _thresholdLine; + + /** + * Field _propertyList. + */ + private java.util.Vector _propertyList; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Annotation() { + super(); + this._annotationElementList = new java.util.Vector(); + this._propertyList = new java.util.Vector(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * + * + * @param vAnnotationElement + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addAnnotationElement( + final jalview.schemabinding.version2.AnnotationElement vAnnotationElement) + throws java.lang.IndexOutOfBoundsException { + this._annotationElementList.addElement(vAnnotationElement); + } + + /** + * + * + * @param index + * @param vAnnotationElement + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addAnnotationElement( + final int index, + final jalview.schemabinding.version2.AnnotationElement vAnnotationElement) + throws java.lang.IndexOutOfBoundsException { + this._annotationElementList.add(index, vAnnotationElement); + } + + /** + * + * + * @param vProperty + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addProperty( + final jalview.schemabinding.version2.Property vProperty) + throws java.lang.IndexOutOfBoundsException { + this._propertyList.addElement(vProperty); + } + + /** + * + * + * @param index + * @param vProperty + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void addProperty( + final int index, + final jalview.schemabinding.version2.Property vProperty) + throws java.lang.IndexOutOfBoundsException { + this._propertyList.add(index, vProperty); + } + + /** + */ + public void deleteAutoCalculated( + ) { + this._has_autoCalculated= false; + } + + /** + */ + public void deleteBelowAlignment( + ) { + this._has_belowAlignment= false; + } + + /** + */ + public void deleteCentreColLabels( + ) { + this._has_centreColLabels= false; + } + + /** + */ + public void deleteGraph( + ) { + this._has_graph= false; + } + + /** + */ + public void deleteGraphColour( + ) { + this._has_graphColour= false; + } + + /** + */ + public void deleteGraphGroup( + ) { + this._has_graphGroup= false; + } + + /** + */ + public void deleteGraphHeight( + ) { + this._has_graphHeight= false; + } + + /** + */ + public void deleteGraphType( + ) { + this._has_graphType= false; + } + + /** + */ + public void deleteScaleColLabels( + ) { + this._has_scaleColLabels= false; + } + + /** + */ + public void deleteScore( + ) { + this._has_score= false; + } + + /** + */ + public void deleteScoreOnly( + ) { + this._has_scoreOnly= false; + } + + /** + */ + public void deleteShowAllColLabels( + ) { + this._has_showAllColLabels= false; + } + + /** + */ + public void deleteVisible( + ) { + this._has_visible= false; + } + + /** + * Method enumerateAnnotationElement. + * + * @return an Enumeration over all + * jalview.schemabinding.version2.AnnotationElement elements + */ + public java.util.Enumeration enumerateAnnotationElement( + ) { + return this._annotationElementList.elements(); + } + + /** + * Method enumerateProperty. + * + * @return an Enumeration over all + * jalview.schemabinding.version2.Property elements + */ + public java.util.Enumeration enumerateProperty( + ) { + return this._propertyList.elements(); + } + + /** + * Method getAnnotationElement. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the + * jalview.schemabinding.version2.AnnotationElement at the + * given index + */ + public jalview.schemabinding.version2.AnnotationElement getAnnotationElement( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._annotationElementList.size()) { + throw new IndexOutOfBoundsException("getAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]"); + } + + return (jalview.schemabinding.version2.AnnotationElement) _annotationElementList.get(index); + } + + /** + * Method getAnnotationElement.Returns the contents of the + * collection in an Array.

Note: Just in case the + * collection contents are changing in another thread, we pass + * a 0-length Array of the correct type into the API call. + * This way we know that the Array returned is of + * exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.schemabinding.version2.AnnotationElement[] getAnnotationElement( + ) { + jalview.schemabinding.version2.AnnotationElement[] array = new jalview.schemabinding.version2.AnnotationElement[0]; + return (jalview.schemabinding.version2.AnnotationElement[]) this._annotationElementList.toArray(array); + } + + /** + * Method getAnnotationElementCount. + * + * @return the size of this collection + */ + public int getAnnotationElementCount( + ) { + return this._annotationElementList.size(); + } + + /** + * Returns the value of field 'autoCalculated'. The field + * 'autoCalculated' has the following description: is an + * autocalculated annotation row + * + * @return the value of field 'AutoCalculated'. + */ + public boolean getAutoCalculated( + ) { + return this._autoCalculated; + } + + /** + * Returns the value of field 'belowAlignment'. The field + * 'belowAlignment' has the following description: is to be + * shown below the alignment - introduced in Jalview 2.8 for + * visualizing T-COFFEE alignment scores + * + * @return the value of field 'BelowAlignment'. + */ + public boolean getBelowAlignment( + ) { + return this._belowAlignment; + } + + /** + * Returns the value of field 'calcId'. The field 'calcId' has + * the following description: Optional string identifier used + * to group sets of annotation produced by a particular + * calculation. Values are opaque strings but have semantic + * meaning to Jalview's renderer, data importer and calculation + * system. + * + * @return the value of field 'CalcId'. + */ + public java.lang.String getCalcId( + ) { + return this._calcId; + } + + /** + * Returns the value of field 'centreColLabels'. + * + * @return the value of field 'CentreColLabels'. + */ + public boolean getCentreColLabels( + ) { + return this._centreColLabels; + } + + /** + * Returns the value of field 'description'. + * + * @return the value of field 'Description'. + */ + public java.lang.String getDescription( + ) { + return this._description; + } + + /** + * Returns the value of field 'graph'. + * + * @return the value of field 'Graph'. + */ + public boolean getGraph( + ) { + return this._graph; + } + + /** + * Returns the value of field 'graphColour'. + * + * @return the value of field 'GraphColour'. + */ + public int getGraphColour( + ) { + return this._graphColour; + } + + /** + * Returns the value of field 'graphGroup'. + * + * @return the value of field 'GraphGroup'. + */ + public int getGraphGroup( + ) { + return this._graphGroup; + } + + /** + * Returns the value of field 'graphHeight'. The field + * 'graphHeight' has the following description: height in + * pixels for the graph if this is a graph-type annotation. + * + * @return the value of field 'GraphHeight'. + */ + public int getGraphHeight( + ) { + return this._graphHeight; + } + + /** + * Returns the value of field 'graphType'. + * + * @return the value of field 'GraphType'. + */ + public int getGraphType( + ) { + return this._graphType; + } + + /** + * Returns the value of field 'groupRef'. + * + * @return the value of field 'GroupRef'. + */ + public java.lang.String getGroupRef( + ) { + return this._groupRef; + } + + /** + * Returns the value of field 'id'. + * + * @return the value of field 'Id'. + */ + public java.lang.String getId( + ) { + return this._id; + } + + /** + * Returns the value of field 'label'. + * + * @return the value of field 'Label'. + */ + public java.lang.String getLabel( + ) { + return this._label; + } + + /** + * Method getProperty. + * + * @param index + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + * @return the value of the + * jalview.schemabinding.version2.Property at the given index + */ + public jalview.schemabinding.version2.Property getProperty( + final int index) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._propertyList.size()) { + throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]"); + } + + return (jalview.schemabinding.version2.Property) _propertyList.get(index); + } + + /** + * Method getProperty.Returns the contents of the collection in + * an Array.

Note: Just in case the collection contents + * are changing in another thread, we pass a 0-length Array of + * the correct type into the API call. This way we know + * that the Array returned is of exactly the correct length. + * + * @return this collection as an Array + */ + public jalview.schemabinding.version2.Property[] getProperty( + ) { + jalview.schemabinding.version2.Property[] array = new jalview.schemabinding.version2.Property[0]; + return (jalview.schemabinding.version2.Property[]) this._propertyList.toArray(array); + } + + /** + * Method getPropertyCount. + * + * @return the size of this collection + */ + public int getPropertyCount( + ) { + return this._propertyList.size(); + } + + /** + * Returns the value of field 'scaleColLabels'. + * + * @return the value of field 'ScaleColLabels'. + */ + public boolean getScaleColLabels( + ) { + return this._scaleColLabels; + } + + /** + * Returns the value of field 'score'. + * + * @return the value of field 'Score'. + */ + public double getScore( + ) { + return this._score; + } + + /** + * Returns the value of field 'scoreOnly'. + * + * @return the value of field 'ScoreOnly'. + */ + public boolean getScoreOnly( + ) { + return this._scoreOnly; + } + + /** + * Returns the value of field 'sequenceRef'. + * + * @return the value of field 'SequenceRef'. + */ + public java.lang.String getSequenceRef( + ) { + return this._sequenceRef; + } + + /** + * Returns the value of field 'showAllColLabels'. + * + * @return the value of field 'ShowAllColLabels'. + */ + public boolean getShowAllColLabels( + ) { + return this._showAllColLabels; + } + + /** + * Returns the value of field 'thresholdLine'. + * + * @return the value of field 'ThresholdLine'. + */ + public jalview.schemabinding.version2.ThresholdLine getThresholdLine( + ) { + return this._thresholdLine; + } + + /** + * Returns the value of field 'visible'. + * + * @return the value of field 'Visible'. + */ + public boolean getVisible( + ) { + return this._visible; + } + + /** + * Method hasAutoCalculated. + * + * @return true if at least one AutoCalculated has been added + */ + public boolean hasAutoCalculated( + ) { + return this._has_autoCalculated; + } + + /** + * Method hasBelowAlignment. + * + * @return true if at least one BelowAlignment has been added + */ + public boolean hasBelowAlignment( + ) { + return this._has_belowAlignment; + } + + /** + * Method hasCentreColLabels. + * + * @return true if at least one CentreColLabels has been added + */ + public boolean hasCentreColLabels( + ) { + return this._has_centreColLabels; + } + + /** + * Method hasGraph. + * + * @return true if at least one Graph has been added + */ + public boolean hasGraph( + ) { + return this._has_graph; + } + + /** + * Method hasGraphColour. + * + * @return true if at least one GraphColour has been added + */ + public boolean hasGraphColour( + ) { + return this._has_graphColour; + } + + /** + * Method hasGraphGroup. + * + * @return true if at least one GraphGroup has been added + */ + public boolean hasGraphGroup( + ) { + return this._has_graphGroup; + } + + /** + * Method hasGraphHeight. + * + * @return true if at least one GraphHeight has been added + */ + public boolean hasGraphHeight( + ) { + return this._has_graphHeight; + } + + /** + * Method hasGraphType. + * + * @return true if at least one GraphType has been added + */ + public boolean hasGraphType( + ) { + return this._has_graphType; + } + + /** + * Method hasScaleColLabels. + * + * @return true if at least one ScaleColLabels has been added + */ + public boolean hasScaleColLabels( + ) { + return this._has_scaleColLabels; + } + + /** + * Method hasScore. + * + * @return true if at least one Score has been added + */ + public boolean hasScore( + ) { + return this._has_score; + } + + /** + * Method hasScoreOnly. + * + * @return true if at least one ScoreOnly has been added + */ + public boolean hasScoreOnly( + ) { + return this._has_scoreOnly; + } + + /** + * Method hasShowAllColLabels. + * + * @return true if at least one ShowAllColLabels has been added + */ + public boolean hasShowAllColLabels( + ) { + return this._has_showAllColLabels; + } + + /** + * Method hasVisible. + * + * @return true if at least one Visible has been added + */ + public boolean hasVisible( + ) { + return this._has_visible; + } + + /** + * Returns the value of field 'autoCalculated'. The field + * 'autoCalculated' has the following description: is an + * autocalculated annotation row + * + * @return the value of field 'AutoCalculated'. + */ + public boolean isAutoCalculated( + ) { + return this._autoCalculated; + } + + /** + * Returns the value of field 'belowAlignment'. The field + * 'belowAlignment' has the following description: is to be + * shown below the alignment - introduced in Jalview 2.8 for + * visualizing T-COFFEE alignment scores + * + * @return the value of field 'BelowAlignment'. + */ + public boolean isBelowAlignment( + ) { + return this._belowAlignment; + } + + /** + * Returns the value of field 'centreColLabels'. + * + * @return the value of field 'CentreColLabels'. + */ + public boolean isCentreColLabels( + ) { + return this._centreColLabels; + } + + /** + * Returns the value of field 'graph'. + * + * @return the value of field 'Graph'. + */ + public boolean isGraph( + ) { + return this._graph; + } + + /** + * Returns the value of field 'scaleColLabels'. + * + * @return the value of field 'ScaleColLabels'. + */ + public boolean isScaleColLabels( + ) { + return this._scaleColLabels; + } + + /** + * Returns the value of field 'scoreOnly'. + * + * @return the value of field 'ScoreOnly'. + */ + public boolean isScoreOnly( + ) { + return this._scoreOnly; + } + + /** + * Returns the value of field 'showAllColLabels'. + * + * @return the value of field 'ShowAllColLabels'. + */ + public boolean isShowAllColLabels( + ) { + return this._showAllColLabels; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * Returns the value of field 'visible'. + * + * @return the value of field 'Visible'. + */ + public boolean isVisible( + ) { + return this._visible; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + */ + public void removeAllAnnotationElement( + ) { + this._annotationElementList.clear(); + } + + /** + */ + public void removeAllProperty( + ) { + this._propertyList.clear(); + } + + /** + * Method removeAnnotationElement. + * + * @param vAnnotationElement + * @return true if the object was removed from the collection. + */ + public boolean removeAnnotationElement( + final jalview.schemabinding.version2.AnnotationElement vAnnotationElement) { + boolean removed = _annotationElementList.remove(vAnnotationElement); + return removed; + } + + /** + * Method removeAnnotationElementAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.schemabinding.version2.AnnotationElement removeAnnotationElementAt( + final int index) { + java.lang.Object obj = this._annotationElementList.remove(index); + return (jalview.schemabinding.version2.AnnotationElement) obj; + } + + /** + * Method removeProperty. + * + * @param vProperty + * @return true if the object was removed from the collection. + */ + public boolean removeProperty( + final jalview.schemabinding.version2.Property vProperty) { + boolean removed = _propertyList.remove(vProperty); + return removed; + } + + /** + * Method removePropertyAt. + * + * @param index + * @return the element removed from the collection + */ + public jalview.schemabinding.version2.Property removePropertyAt( + final int index) { + java.lang.Object obj = this._propertyList.remove(index); + return (jalview.schemabinding.version2.Property) obj; + } + + /** + * + * + * @param index + * @param vAnnotationElement + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setAnnotationElement( + final int index, + final jalview.schemabinding.version2.AnnotationElement vAnnotationElement) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._annotationElementList.size()) { + throw new IndexOutOfBoundsException("setAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]"); + } + + this._annotationElementList.set(index, vAnnotationElement); + } + + /** + * + * + * @param vAnnotationElementArray + */ + public void setAnnotationElement( + final jalview.schemabinding.version2.AnnotationElement[] vAnnotationElementArray) { + //-- copy array + _annotationElementList.clear(); + + for (int i = 0; i < vAnnotationElementArray.length; i++) { + this._annotationElementList.add(vAnnotationElementArray[i]); + } + } + + /** + * Sets the value of field 'autoCalculated'. The field + * 'autoCalculated' has the following description: is an + * autocalculated annotation row + * + * @param autoCalculated the value of field 'autoCalculated'. + */ + public void setAutoCalculated( + final boolean autoCalculated) { + this._autoCalculated = autoCalculated; + this._has_autoCalculated = true; + } + + /** + * Sets the value of field 'belowAlignment'. The field + * 'belowAlignment' has the following description: is to be + * shown below the alignment - introduced in Jalview 2.8 for + * visualizing T-COFFEE alignment scores + * + * @param belowAlignment the value of field 'belowAlignment'. + */ + public void setBelowAlignment( + final boolean belowAlignment) { + this._belowAlignment = belowAlignment; + this._has_belowAlignment = true; + } + + /** + * Sets the value of field 'calcId'. The field 'calcId' has the + * following description: Optional string identifier used to + * group sets of annotation produced by a particular + * calculation. Values are opaque strings but have semantic + * meaning to Jalview's renderer, data importer and calculation + * system. + * + * @param calcId the value of field 'calcId'. + */ + public void setCalcId( + final java.lang.String calcId) { + this._calcId = calcId; + } + + /** + * Sets the value of field 'centreColLabels'. + * + * @param centreColLabels the value of field 'centreColLabels'. + */ + public void setCentreColLabels( + final boolean centreColLabels) { + this._centreColLabels = centreColLabels; + this._has_centreColLabels = true; + } + + /** + * Sets the value of field 'description'. + * + * @param description the value of field 'description'. + */ + public void setDescription( + final java.lang.String description) { + this._description = description; + } + + /** + * Sets the value of field 'graph'. + * + * @param graph the value of field 'graph'. + */ + public void setGraph( + final boolean graph) { + this._graph = graph; + this._has_graph = true; + } + + /** + * Sets the value of field 'graphColour'. + * + * @param graphColour the value of field 'graphColour'. + */ + public void setGraphColour( + final int graphColour) { + this._graphColour = graphColour; + this._has_graphColour = true; + } + + /** + * Sets the value of field 'graphGroup'. + * + * @param graphGroup the value of field 'graphGroup'. + */ + public void setGraphGroup( + final int graphGroup) { + this._graphGroup = graphGroup; + this._has_graphGroup = true; + } + + /** + * Sets the value of field 'graphHeight'. The field + * 'graphHeight' has the following description: height in + * pixels for the graph if this is a graph-type annotation. + * + * @param graphHeight the value of field 'graphHeight'. + */ + public void setGraphHeight( + final int graphHeight) { + this._graphHeight = graphHeight; + this._has_graphHeight = true; + } + + /** + * Sets the value of field 'graphType'. + * + * @param graphType the value of field 'graphType'. + */ + public void setGraphType( + final int graphType) { + this._graphType = graphType; + this._has_graphType = true; + } + + /** + * Sets the value of field 'groupRef'. + * + * @param groupRef the value of field 'groupRef'. + */ + public void setGroupRef( + final java.lang.String groupRef) { + this._groupRef = groupRef; + } + + /** + * Sets the value of field 'id'. + * + * @param id the value of field 'id'. + */ + public void setId( + final java.lang.String id) { + this._id = id; + } + + /** + * Sets the value of field 'label'. + * + * @param label the value of field 'label'. + */ + public void setLabel( + final java.lang.String label) { + this._label = label; + } + + /** + * + * + * @param index + * @param vProperty + * @throws java.lang.IndexOutOfBoundsException if the index + * given is outside the bounds of the collection + */ + public void setProperty( + final int index, + final jalview.schemabinding.version2.Property vProperty) + throws java.lang.IndexOutOfBoundsException { + // check bounds for index + if (index < 0 || index >= this._propertyList.size()) { + throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]"); + } + + this._propertyList.set(index, vProperty); + } + + /** + * + * + * @param vPropertyArray + */ + public void setProperty( + final jalview.schemabinding.version2.Property[] vPropertyArray) { + //-- copy array + _propertyList.clear(); + + for (int i = 0; i < vPropertyArray.length; i++) { + this._propertyList.add(vPropertyArray[i]); + } + } + + /** + * Sets the value of field 'scaleColLabels'. + * + * @param scaleColLabels the value of field 'scaleColLabels'. + */ + public void setScaleColLabels( + final boolean scaleColLabels) { + this._scaleColLabels = scaleColLabels; + this._has_scaleColLabels = true; + } + + /** + * Sets the value of field 'score'. + * + * @param score the value of field 'score'. + */ + public void setScore( + final double score) { + this._score = score; + this._has_score = true; + } + + /** + * Sets the value of field 'scoreOnly'. + * + * @param scoreOnly the value of field 'scoreOnly'. + */ + public void setScoreOnly( + final boolean scoreOnly) { + this._scoreOnly = scoreOnly; + this._has_scoreOnly = true; + } + + /** + * Sets the value of field 'sequenceRef'. + * + * @param sequenceRef the value of field 'sequenceRef'. + */ + public void setSequenceRef( + final java.lang.String sequenceRef) { + this._sequenceRef = sequenceRef; + } + + /** + * Sets the value of field 'showAllColLabels'. + * + * @param showAllColLabels the value of field 'showAllColLabels' + */ + public void setShowAllColLabels( + final boolean showAllColLabels) { + this._showAllColLabels = showAllColLabels; + this._has_showAllColLabels = true; + } + + /** + * Sets the value of field 'thresholdLine'. + * + * @param thresholdLine the value of field 'thresholdLine'. + */ + public void setThresholdLine( + final jalview.schemabinding.version2.ThresholdLine thresholdLine) { + this._thresholdLine = thresholdLine; + } + + /** + * Sets the value of field 'visible'. + * + * @param visible the value of field 'visible'. + */ + public void setVisible( + final boolean visible) { + this._visible = visible; + this._has_visible = true; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled + * jalview.schemabinding.version2.Annotation + */ + public static jalview.schemabinding.version2.Annotation unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.schemabinding.version2.Annotation) Unmarshaller.unmarshal(jalview.schemabinding.version2.Annotation.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } } diff --git a/src/jalview/schemabinding/version2/Property.java b/src/jalview/schemabinding/version2/Property.java index 4dcbfc5..714544d 100644 --- a/src/jalview/schemabinding/version2/Property.java +++ b/src/jalview/schemabinding/version2/Property.java @@ -1,27 +1,14 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) - * Copyright (C) 2014 The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. + * This class was automatically generated with + * Castor 1.1, using an XML + * Schema. + * $Id$ */ + package jalview.schemabinding.version2; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import org.exolab.castor.xml.Marshaller; @@ -32,163 +19,152 @@ import org.exolab.castor.xml.Unmarshaller; * * @version $Revision$ $Date$ */ -public class Property implements java.io.Serializable -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _name. - */ - private java.lang.String _name; - - /** - * Field _value. - */ - private java.lang.String _value; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public Property() - { - super(); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * Returns the value of field 'name'. - * - * @return the value of field 'Name'. - */ - public java.lang.String getName() - { - return this._name; - } - - /** - * Returns the value of field 'value'. - * - * @return the value of field 'Value'. - */ - public java.lang.String getValue() - { - return this._value; - } - - /** - * Method isValid. - * - * @return true if this object is valid according to the schema - */ - public boolean isValid() - { - try - { - validate(); - } catch (org.exolab.castor.xml.ValidationException vex) - { - return false; +public class Property implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _name. + */ + private java.lang.String _name; + + /** + * Field _value. + */ + private java.lang.String _value; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Property() { + super(); + } + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Returns the value of field 'name'. + * + * @return the value of field 'Name'. + */ + public java.lang.String getName( + ) { + return this._name; + } + + /** + * Returns the value of field 'value'. + * + * @return the value of field 'Value'. + */ + public java.lang.String getValue( + ) { + return this._value; + } + + /** + * Method isValid. + * + * @return true if this object is valid according to the schema + */ + public boolean isValid( + ) { + try { + validate(); + } catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } + + /** + * + * + * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, out); + } + + /** + * + * + * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + */ + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + Marshaller.marshal(this, handler); + } + + /** + * Sets the value of field 'name'. + * + * @param name the value of field 'name'. + */ + public void setName( + final java.lang.String name) { + this._name = name; + } + + /** + * Sets the value of field 'value'. + * + * @param value the value of field 'value'. + */ + public void setValue( + final java.lang.String value) { + this._value = value; + } + + /** + * Method unmarshal. + * + * @param reader + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled + * jalview.schemabinding.version2.Property + */ + public static jalview.schemabinding.version2.Property unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (jalview.schemabinding.version2.Property) Unmarshaller.unmarshal(jalview.schemabinding.version2.Property.class, reader); + } + + /** + * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + */ + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); } - return true; - } - - /** - * - * - * @param out - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void marshal(final java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, out); - } - - /** - * - * - * @param handler - * @throws java.io.IOException - * if an IOException occurs during marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - */ - public void marshal(final org.xml.sax.ContentHandler handler) - throws java.io.IOException, - org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - Marshaller.marshal(this, handler); - } - - /** - * Sets the value of field 'name'. - * - * @param name - * the value of field 'name'. - */ - public void setName(final java.lang.String name) - { - this._name = name; - } - - /** - * Sets the value of field 'value'. - * - * @param value - * the value of field 'value'. - */ - public void setValue(final java.lang.String value) - { - this._value = value; - } - - /** - * Method unmarshal. - * - * @param reader - * @throws org.exolab.castor.xml.MarshalException - * if object is null or if any SAXException is thrown during - * marshaling - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - * @return the unmarshaled jalview.schemabinding.version2.Property - */ - public static jalview.schemabinding.version2.Property unmarshal( - final java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, - org.exolab.castor.xml.ValidationException - { - return (jalview.schemabinding.version2.Property) Unmarshaller - .unmarshal(jalview.schemabinding.version2.Property.class, - reader); - } - - /** - * - * - * @throws org.exolab.castor.xml.ValidationException - * if this object is an invalid instance according to the schema - */ - public void validate() throws org.exolab.castor.xml.ValidationException - { - org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); - validator.validate(this); - } } diff --git a/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java index 8cfdbc8..e401d8e 100644 --- a/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java @@ -20,8 +20,8 @@ */ package jalview.schemabinding.version2.descriptors; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import jalview.schemabinding.version2.Annotation; @@ -31,1226 +31,1029 @@ import jalview.schemabinding.version2.Annotation; * * @version $Revision$ $Date$ */ -public class AnnotationDescriptor extends - org.exolab.castor.xml.util.XMLClassDescriptorImpl -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _elementDefinition. - */ - private boolean _elementDefinition; - - /** - * Field _nsPrefix. - */ - private java.lang.String _nsPrefix; - - /** - * Field _nsURI. - */ - private java.lang.String _nsURI; - - /** - * Field _xmlName. - */ - private java.lang.String _xmlName; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public AnnotationDescriptor() - { - super(); - _nsURI = "www.vamsas.ac.uk/jalview/version2"; - _xmlName = "Annotation"; - _elementDefinition = true; - - // -- set grouping compositor - setCompositorAsSequence(); - org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; - org.exolab.castor.mapping.FieldHandler handler = null; - org.exolab.castor.xml.FieldValidator fieldValidator = null; - // -- initialize attribute descriptors - - // -- _graph - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.Boolean.TYPE, "_graph", "graph", - org.exolab.castor.xml.NodeType.Attribute); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - if (!target.hasGraph()) - { - return null; +public class AnnotationDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public AnnotationDescriptor() { + super(); + _nsURI = "www.vamsas.ac.uk/jalview/version2"; + _xmlName = "Annotation"; + _elementDefinition = true; + + //-- set grouping compositor + setCompositorAsSequence(); + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + //-- initialize attribute descriptors + + //-- _graph + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_graph", "graph", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + if (!target.hasGraph()) { return null; } + return (target.getGraph() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + // ignore null values for non optional primitives + if (value == null) { return; } + + target.setGraph( ((java.lang.Boolean) value).booleanValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _graph + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + org.exolab.castor.xml.validators.BooleanValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); + fieldValidator.setValidator(typeValidator); } - return (target.getGraph() ? java.lang.Boolean.TRUE - : java.lang.Boolean.FALSE); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - // ignore null values for non optional primitives - if (value == null) - { - return; - } - - target.setGraph(((java.lang.Boolean) value).booleanValue()); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); - } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setRequired(true); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _graph - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - fieldValidator.setMinOccurs(1); - { // -- local scope - org.exolab.castor.xml.validators.BooleanValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); - fieldValidator.setValidator(typeValidator); - } - desc.setValidator(fieldValidator); - // -- _graphType - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.Integer.TYPE, "_graphType", "graphType", - org.exolab.castor.xml.NodeType.Attribute); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - if (!target.hasGraphType()) - { - return null; + desc.setValidator(fieldValidator); + //-- _graphType + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_graphType", "graphType", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + if (!target.hasGraphType()) { return null; } + return new java.lang.Integer(target.getGraphType()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteGraphType(); + return; + } + target.setGraphType( ((java.lang.Integer) value).intValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _graphType + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.IntValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.IntValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setMinInclusive(-2147483648); + typeValidator.setMaxInclusive(2147483647); } - return new java.lang.Integer(target.getGraphType()); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - // if null, use delete method for optional primitives - if (value == null) - { - target.deleteGraphType(); - return; - } - target.setGraphType(((java.lang.Integer) value).intValue()); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); + desc.setValidator(fieldValidator); + //-- _sequenceRef + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_sequenceRef", "sequenceRef", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + return target.getSequenceRef(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + target.setSequenceRef( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _sequenceRef + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _graphType - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.IntValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.IntValidator(); - fieldValidator.setValidator(typeValidator); - typeValidator.setMinInclusive(-2147483648); - typeValidator.setMaxInclusive(2147483647); - } - desc.setValidator(fieldValidator); - // -- _sequenceRef - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.String.class, "_sequenceRef", "sequenceRef", - org.exolab.castor.xml.NodeType.Attribute); - desc.setImmutable(true); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - return target.getSequenceRef(); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - target.setSequenceRef((java.lang.String) value); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); + desc.setValidator(fieldValidator); + //-- _groupRef + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_groupRef", "groupRef", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + return target.getGroupRef(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + target.setGroupRef( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _groupRef + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _sequenceRef - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.StringValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.StringValidator(); - fieldValidator.setValidator(typeValidator); - typeValidator.setWhiteSpace("preserve"); - } - desc.setValidator(fieldValidator); - // -- _groupRef - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.String.class, "_groupRef", "groupRef", - org.exolab.castor.xml.NodeType.Attribute); - desc.setImmutable(true); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - return target.getGroupRef(); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - target.setGroupRef((java.lang.String) value); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); + desc.setValidator(fieldValidator); + //-- _graphColour + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_graphColour", "graphColour", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + if (!target.hasGraphColour()) { return null; } + return new java.lang.Integer(target.getGraphColour()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteGraphColour(); + return; + } + target.setGraphColour( ((java.lang.Integer) value).intValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _graphColour + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.IntValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.IntValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setMinInclusive(-2147483648); + typeValidator.setMaxInclusive(2147483647); } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _groupRef - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.StringValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.StringValidator(); - fieldValidator.setValidator(typeValidator); - typeValidator.setWhiteSpace("preserve"); - } - desc.setValidator(fieldValidator); - // -- _graphColour - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.Integer.TYPE, "_graphColour", "graphColour", - org.exolab.castor.xml.NodeType.Attribute); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - if (!target.hasGraphColour()) - { - return null; + desc.setValidator(fieldValidator); + //-- _graphGroup + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_graphGroup", "graphGroup", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + if (!target.hasGraphGroup()) { return null; } + return new java.lang.Integer(target.getGraphGroup()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteGraphGroup(); + return; + } + target.setGraphGroup( ((java.lang.Integer) value).intValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _graphGroup + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.IntValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.IntValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setMinInclusive(-2147483648); + typeValidator.setMaxInclusive(2147483647); } - return new java.lang.Integer(target.getGraphColour()); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - // if null, use delete method for optional primitives - if (value == null) - { - target.deleteGraphColour(); - return; - } - target.setGraphColour(((java.lang.Integer) value).intValue()); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); + desc.setValidator(fieldValidator); + //-- _graphHeight + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_graphHeight", "graphHeight", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + if (!target.hasGraphHeight()) { return null; } + return new java.lang.Integer(target.getGraphHeight()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteGraphHeight(); + return; + } + target.setGraphHeight( ((java.lang.Integer) value).intValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _graphHeight + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.IntValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.IntValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setMinInclusive(-2147483648); + typeValidator.setMaxInclusive(2147483647); } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _graphColour - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.IntValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.IntValidator(); - fieldValidator.setValidator(typeValidator); - typeValidator.setMinInclusive(-2147483648); - typeValidator.setMaxInclusive(2147483647); - } - desc.setValidator(fieldValidator); - // -- _graphGroup - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.Integer.TYPE, "_graphGroup", "graphGroup", - org.exolab.castor.xml.NodeType.Attribute); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - if (!target.hasGraphGroup()) - { - return null; + desc.setValidator(fieldValidator); + //-- _id + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + return target.getId(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + target.setId( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _id + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); } - return new java.lang.Integer(target.getGraphGroup()); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - // if null, use delete method for optional primitives - if (value == null) - { - target.deleteGraphGroup(); - return; - } - target.setGraphGroup(((java.lang.Integer) value).intValue()); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); + desc.setValidator(fieldValidator); + //-- _scoreOnly + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_scoreOnly", "scoreOnly", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + if (!target.hasScoreOnly()) { return null; } + return (target.getScoreOnly() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteScoreOnly(); + return; + } + target.setScoreOnly( ((java.lang.Boolean) value).booleanValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _scoreOnly + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.BooleanValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); + fieldValidator.setValidator(typeValidator); } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _graphGroup - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.IntValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.IntValidator(); - fieldValidator.setValidator(typeValidator); - typeValidator.setMinInclusive(-2147483648); - typeValidator.setMaxInclusive(2147483647); - } - desc.setValidator(fieldValidator); - // -- _graphHeight - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.Integer.TYPE, "_graphHeight", "graphHeight", - org.exolab.castor.xml.NodeType.Attribute); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - if (!target.hasGraphHeight()) - { - return null; + desc.setValidator(fieldValidator); + //-- _score + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Double.TYPE, "_score", "score", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + if (!target.hasScore()) { return null; } + return new java.lang.Double(target.getScore()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteScore(); + return; + } + target.setScore( ((java.lang.Double) value).doubleValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _score + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.DoubleValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.DoubleValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setMinInclusive(-1.7976931348623157E308); + typeValidator.setMaxInclusive(1.7976931348623157E308); } - return new java.lang.Integer(target.getGraphHeight()); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - // if null, use delete method for optional primitives - if (value == null) - { - target.deleteGraphHeight(); - return; - } - target.setGraphHeight(((java.lang.Integer) value).intValue()); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); + desc.setValidator(fieldValidator); + //-- _visible + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_visible", "visible", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + if (!target.hasVisible()) { return null; } + return (target.getVisible() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteVisible(); + return; + } + target.setVisible( ((java.lang.Boolean) value).booleanValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _visible + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.BooleanValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); + fieldValidator.setValidator(typeValidator); } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _graphHeight - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.IntValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.IntValidator(); - fieldValidator.setValidator(typeValidator); - typeValidator.setMinInclusive(-2147483648); - typeValidator.setMaxInclusive(2147483647); - } - desc.setValidator(fieldValidator); - // -- _id - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.String.class, "_id", "id", - org.exolab.castor.xml.NodeType.Attribute); - desc.setImmutable(true); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - return target.getId(); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - target.setId((java.lang.String) value); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); + desc.setValidator(fieldValidator); + //-- _centreColLabels + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_centreColLabels", "centreColLabels", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + if (!target.hasCentreColLabels()) { return null; } + return (target.getCentreColLabels() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteCentreColLabels(); + return; + } + target.setCentreColLabels( ((java.lang.Boolean) value).booleanValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _centreColLabels + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.BooleanValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); + fieldValidator.setValidator(typeValidator); } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _id - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.StringValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.StringValidator(); - fieldValidator.setValidator(typeValidator); - typeValidator.setWhiteSpace("preserve"); - } - desc.setValidator(fieldValidator); - // -- _scoreOnly - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.Boolean.TYPE, "_scoreOnly", "scoreOnly", - org.exolab.castor.xml.NodeType.Attribute); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - if (!target.hasScoreOnly()) - { - return null; + desc.setValidator(fieldValidator); + //-- _scaleColLabels + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_scaleColLabels", "scaleColLabels", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + if (!target.hasScaleColLabels()) { return null; } + return (target.getScaleColLabels() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteScaleColLabels(); + return; + } + target.setScaleColLabels( ((java.lang.Boolean) value).booleanValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _scaleColLabels + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.BooleanValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); + fieldValidator.setValidator(typeValidator); } - return (target.getScoreOnly() ? java.lang.Boolean.TRUE - : java.lang.Boolean.FALSE); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - // if null, use delete method for optional primitives - if (value == null) - { - target.deleteScoreOnly(); - return; - } - target.setScoreOnly(((java.lang.Boolean) value).booleanValue()); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); + desc.setValidator(fieldValidator); + //-- _showAllColLabels + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showAllColLabels", "showAllColLabels", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + if (!target.hasShowAllColLabels()) { return null; } + return (target.getShowAllColLabels() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteShowAllColLabels(); + return; + } + target.setShowAllColLabels( ((java.lang.Boolean) value).booleanValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _showAllColLabels + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.BooleanValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); + fieldValidator.setValidator(typeValidator); } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _scoreOnly - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.BooleanValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); - fieldValidator.setValidator(typeValidator); - } - desc.setValidator(fieldValidator); - // -- _score - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.Double.TYPE, "_score", "score", - org.exolab.castor.xml.NodeType.Attribute); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - if (!target.hasScore()) - { - return null; + desc.setValidator(fieldValidator); + //-- _autoCalculated + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_autoCalculated", "autoCalculated", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + if (!target.hasAutoCalculated()) { return null; } + return (target.getAutoCalculated() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteAutoCalculated(); + return; + } + target.setAutoCalculated( ((java.lang.Boolean) value).booleanValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _autoCalculated + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.BooleanValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); + fieldValidator.setValidator(typeValidator); } - return new java.lang.Double(target.getScore()); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - // if null, use delete method for optional primitives - if (value == null) - { - target.deleteScore(); - return; - } - target.setScore(((java.lang.Double) value).doubleValue()); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); + desc.setValidator(fieldValidator); + //-- _belowAlignment + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_belowAlignment", "belowAlignment", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + if (!target.hasBelowAlignment()) { return null; } + return (target.getBelowAlignment() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteBelowAlignment(); + return; + } + target.setBelowAlignment( ((java.lang.Boolean) value).booleanValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _belowAlignment + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.BooleanValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); + fieldValidator.setValidator(typeValidator); } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _score - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.DoubleValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.DoubleValidator(); - fieldValidator.setValidator(typeValidator); - typeValidator.setMinInclusive(-1.7976931348623157E308); - typeValidator.setMaxInclusive(1.7976931348623157E308); - } - desc.setValidator(fieldValidator); - // -- _visible - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.Boolean.TYPE, "_visible", "visible", - org.exolab.castor.xml.NodeType.Attribute); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - if (!target.hasVisible()) - { - return null; + desc.setValidator(fieldValidator); + //-- _calcId + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_calcId", "calcId", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + return target.getCalcId(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + target.setCalcId( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _calcId + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); } - return (target.getVisible() ? java.lang.Boolean.TRUE - : java.lang.Boolean.FALSE); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - // if null, use delete method for optional primitives - if (value == null) - { - target.deleteVisible(); - return; - } - target.setVisible(((java.lang.Boolean) value).booleanValue()); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); + desc.setValidator(fieldValidator); + //-- initialize element descriptors + + //-- _annotationElementList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.AnnotationElement.class, "_annotationElementList", "annotationElement", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + return target.getAnnotationElement(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + target.addAnnotationElement( (jalview.schemabinding.version2.AnnotationElement) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException { + try { + Annotation target = (Annotation) object; + target.removeAllAnnotationElement(); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return new jalview.schemabinding.version2.AnnotationElement(); + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2"); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _annotationElementList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + { //-- local scope } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _visible - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.BooleanValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); - fieldValidator.setValidator(typeValidator); - } - desc.setValidator(fieldValidator); - // -- _centreColLabels - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.Boolean.TYPE, "_centreColLabels", "centreColLabels", - org.exolab.castor.xml.NodeType.Attribute); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - if (!target.hasCentreColLabels()) - { - return null; + desc.setValidator(fieldValidator); + //-- _label + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_label", "label", org.exolab.castor.xml.NodeType.Element); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + return target.getLabel(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + target.setLabel( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2"); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _label + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); } - return (target.getCentreColLabels() ? java.lang.Boolean.TRUE - : java.lang.Boolean.FALSE); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - // if null, use delete method for optional primitives - if (value == null) - { - target.deleteCentreColLabels(); - return; - } - target.setCentreColLabels(((java.lang.Boolean) value) - .booleanValue()); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); + desc.setValidator(fieldValidator); + //-- _description + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + return target.getDescription(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + target.setDescription( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2"); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _description + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _centreColLabels - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.BooleanValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); - fieldValidator.setValidator(typeValidator); - } - desc.setValidator(fieldValidator); - // -- _scaleColLabels - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.Boolean.TYPE, "_scaleColLabels", "scaleColLabels", - org.exolab.castor.xml.NodeType.Attribute); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - if (!target.hasScaleColLabels()) - { - return null; + desc.setValidator(fieldValidator); + //-- _thresholdLine + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.ThresholdLine.class, "_thresholdLine", "thresholdLine", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + return target.getThresholdLine(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + target.setThresholdLine( (jalview.schemabinding.version2.ThresholdLine) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return new jalview.schemabinding.version2.ThresholdLine(); + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2"); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _thresholdLine + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope } - return (target.getScaleColLabels() ? java.lang.Boolean.TRUE - : java.lang.Boolean.FALSE); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - // if null, use delete method for optional primitives - if (value == null) - { - target.deleteScaleColLabels(); - return; - } - target.setScaleColLabels(((java.lang.Boolean) value) - .booleanValue()); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); + desc.setValidator(fieldValidator); + //-- _propertyList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + return target.getProperty(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + target.addProperty( (jalview.schemabinding.version2.Property) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException { + try { + Annotation target = (Annotation) object; + target.removeAllProperty(); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return new jalview.schemabinding.version2.Property(); + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2"); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _propertyList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + { //-- local scope } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _scaleColLabels - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.BooleanValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); - fieldValidator.setValidator(typeValidator); + desc.setValidator(fieldValidator); } - desc.setValidator(fieldValidator); - // -- _showAllColLabels - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.Boolean.TYPE, "_showAllColLabels", - "showAllColLabels", org.exolab.castor.xml.NodeType.Attribute); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - if (!target.hasShowAllColLabels()) - { - return null; - } - return (target.getShowAllColLabels() ? java.lang.Boolean.TRUE - : java.lang.Boolean.FALSE); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - // if null, use delete method for optional primitives - if (value == null) - { - target.deleteShowAllColLabels(); - return; - } - target.setShowAllColLabels(((java.lang.Boolean) value) - .booleanValue()); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); - } - } - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - // -- validation code for: _showAllColLabels - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.BooleanValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); - fieldValidator.setValidator(typeValidator); - } - desc.setValidator(fieldValidator); - // -- _autoCalculated - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.Boolean.TYPE, "_autoCalculated", "autoCalculated", - org.exolab.castor.xml.NodeType.Attribute); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - if (!target.hasAutoCalculated()) - { - return null; - } - return (target.getAutoCalculated() ? java.lang.Boolean.TRUE - : java.lang.Boolean.FALSE); - } + //-----------/ + //- Methods -/ + //-----------/ - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - // if null, use delete method for optional primitives - if (value == null) - { - target.deleteAutoCalculated(); - return; - } - target.setAutoCalculated(((java.lang.Boolean) value) - .booleanValue()); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); - } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode( + ) { return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _autoCalculated - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.BooleanValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); - fieldValidator.setValidator(typeValidator); } - desc.setValidator(fieldValidator); - // -- _belowAlignment - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.Boolean.TYPE, "_belowAlignment", "belowAlignment", - org.exolab.castor.xml.NodeType.Attribute); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - if (!target.hasBelowAlignment()) - { - return null; - } - return (target.getBelowAlignment() ? java.lang.Boolean.TRUE - : java.lang.Boolean.FALSE); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - // if null, use delete method for optional primitives - if (value == null) - { - target.deleteBelowAlignment(); - return; - } - target.setBelowAlignment(((java.lang.Boolean) value) - .booleanValue()); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); - } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - // -- validation code for: _belowAlignment - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.BooleanValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); - fieldValidator.setValidator(typeValidator); + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no + * identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity( + ) { + return super.getIdentity(); } - desc.setValidator(fieldValidator); - // -- _calcId - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.String.class, "_calcId", "calcId", - org.exolab.castor.xml.NodeType.Attribute); - desc.setImmutable(true); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - return target.getCalcId(); - } - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - target.setCalcId((java.lang.String) value); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); - } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _calcId - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.StringValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.StringValidator(); - fieldValidator.setValidator(typeValidator); - typeValidator.setWhiteSpace("preserve"); + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass( + ) { + return jalview.schemabinding.version2.Annotation.class; } - desc.setValidator(fieldValidator); - // -- initialize element descriptors - // -- _annotationElementList - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - jalview.schemabinding.version2.AnnotationElement.class, - "_annotationElementList", "annotationElement", - org.exolab.castor.xml.NodeType.Element); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - return target.getAnnotationElement(); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - target.addAnnotationElement((jalview.schemabinding.version2.AnnotationElement) value); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); - } - } - - public void resetValue(Object object) throws IllegalStateException, - IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - target.removeAllAnnotationElement(); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); - } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return new jalview.schemabinding.version2.AnnotationElement(); - } - }; - desc.setHandler(handler); - desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2"); - desc.setMultivalued(true); - addFieldDescriptor(desc); - - // -- validation code for: _annotationElementList - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - fieldValidator.setMinOccurs(0); - { // -- local scope + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix( + ) { + return _nsPrefix; } - desc.setValidator(fieldValidator); - // -- _label - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.String.class, "_label", "label", - org.exolab.castor.xml.NodeType.Element); - desc.setImmutable(true); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - return target.getLabel(); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - target.setLabel((java.lang.String) value); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); - } - } - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2"); - desc.setRequired(true); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _label - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - fieldValidator.setMinOccurs(1); - { // -- local scope - org.exolab.castor.xml.validators.StringValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.StringValidator(); - fieldValidator.setValidator(typeValidator); - typeValidator.setWhiteSpace("preserve"); + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and + * unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI( + ) { + return _nsURI; } - desc.setValidator(fieldValidator); - // -- _description - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.String.class, "_description", "description", - org.exolab.castor.xml.NodeType.Element); - desc.setImmutable(true); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - return target.getDescription(); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - target.setDescription((java.lang.String) value); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); - } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2"); - desc.setMultivalued(false); - addFieldDescriptor(desc); - // -- validation code for: _description - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope - org.exolab.castor.xml.validators.StringValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.StringValidator(); - fieldValidator.setValidator(typeValidator); - typeValidator.setWhiteSpace("preserve"); + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator( + ) { + return this; } - desc.setValidator(fieldValidator); - // -- _thresholdLine - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - jalview.schemabinding.version2.ThresholdLine.class, - "_thresholdLine", "thresholdLine", - org.exolab.castor.xml.NodeType.Element); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Annotation target = (Annotation) object; - return target.getThresholdLine(); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Annotation target = (Annotation) object; - target.setThresholdLine((jalview.schemabinding.version2.ThresholdLine) value); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); - } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return new jalview.schemabinding.version2.ThresholdLine(); - } - }; - desc.setHandler(handler); - desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2"); - desc.setMultivalued(false); - addFieldDescriptor(desc); - // -- validation code for: _thresholdLine - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - { // -- local scope + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName( + ) { + return _xmlName; } - desc.setValidator(fieldValidator); - } - - // -----------/ - // - Methods -/ - // -----------/ - - /** - * Method getAccessMode. - * - * @return the access mode specified for this class. - */ - public org.exolab.castor.mapping.AccessMode getAccessMode() - { - return null; - } - /** - * Method getIdentity. - * - * @return the identity field, null if this class has no identity. - */ - public org.exolab.castor.mapping.FieldDescriptor getIdentity() - { - return super.getIdentity(); - } - - /** - * Method getJavaClass. - * - * @return the Java class represented by this descriptor. - */ - public java.lang.Class getJavaClass() - { - return jalview.schemabinding.version2.Annotation.class; - } - - /** - * Method getNameSpacePrefix. - * - * @return the namespace prefix to use when marshaling as XML. - */ - public java.lang.String getNameSpacePrefix() - { - return _nsPrefix; - } - - /** - * Method getNameSpaceURI. - * - * @return the namespace URI used when marshaling and unmarshaling as XML. - */ - public java.lang.String getNameSpaceURI() - { - return _nsURI; - } - - /** - * Method getValidator. - * - * @return a specific validator for the class described by this - * ClassDescriptor. - */ - public org.exolab.castor.xml.TypeValidator getValidator() - { - return this; - } - - /** - * Method getXMLName. - * - * @return the XML Name for the Class being described. - */ - public java.lang.String getXMLName() - { - return _xmlName; - } - - /** - * Method isElementDefinition. - * - * @return true if XML schema definition of this Class is that of a global - * element or element with anonymous type definition. - */ - public boolean isElementDefinition() - { - return _elementDefinition; - } + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that + * of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition( + ) { + return _elementDefinition; + } } diff --git a/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java b/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java index 2a5817b..56f2742 100644 --- a/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java @@ -20,8 +20,8 @@ */ package jalview.schemabinding.version2.descriptors; -//---------------------------------/ -//- Imported classes and packages -/ + //---------------------------------/ + //- Imported classes and packages -/ //---------------------------------/ import jalview.schemabinding.version2.Property; @@ -31,231 +31,218 @@ import jalview.schemabinding.version2.Property; * * @version $Revision$ $Date$ */ -public class PropertyDescriptor extends - org.exolab.castor.xml.util.XMLClassDescriptorImpl -{ - - // --------------------------/ - // - Class/Member Variables -/ - // --------------------------/ - - /** - * Field _elementDefinition. - */ - private boolean _elementDefinition; - - /** - * Field _nsPrefix. - */ - private java.lang.String _nsPrefix; - - /** - * Field _nsURI. - */ - private java.lang.String _nsURI; - - /** - * Field _xmlName. - */ - private java.lang.String _xmlName; - - // ----------------/ - // - Constructors -/ - // ----------------/ - - public PropertyDescriptor() - { - super(); - _nsURI = "www.jalview.org"; - _xmlName = "property"; - _elementDefinition = true; - org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; - org.exolab.castor.mapping.FieldHandler handler = null; - org.exolab.castor.xml.FieldValidator fieldValidator = null; - // -- initialize attribute descriptors - - // -- _name - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.String.class, "_name", "name", - org.exolab.castor.xml.NodeType.Attribute); - desc.setImmutable(true); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Property target = (Property) object; - return target.getName(); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Property target = (Property) object; - target.setName((java.lang.String) value); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); +public class PropertyDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _elementDefinition. + */ + private boolean _elementDefinition; + + /** + * Field _nsPrefix. + */ + private java.lang.String _nsPrefix; + + /** + * Field _nsURI. + */ + private java.lang.String _nsURI; + + /** + * Field _xmlName. + */ + private java.lang.String _xmlName; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public PropertyDescriptor() { + super(); + _nsURI = "www.jalview.org"; + _xmlName = "property"; + _elementDefinition = true; + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + //-- initialize attribute descriptors + + //-- _name + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Property target = (Property) object; + return target.getName(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Property target = (Property) object; + target.setName( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _name + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setRequired(true); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _name - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - fieldValidator.setMinOccurs(1); - { // -- local scope - org.exolab.castor.xml.validators.StringValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.StringValidator(); - fieldValidator.setValidator(typeValidator); - typeValidator.setWhiteSpace("preserve"); - } - desc.setValidator(fieldValidator); - // -- _value - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl( - java.lang.String.class, "_value", "value", - org.exolab.castor.xml.NodeType.Attribute); - desc.setImmutable(true); - handler = new org.exolab.castor.xml.XMLFieldHandler() - { - public java.lang.Object getValue(java.lang.Object object) - throws IllegalStateException - { - Property target = (Property) object; - return target.getValue(); - } - - public void setValue(java.lang.Object object, java.lang.Object value) - throws IllegalStateException, IllegalArgumentException - { - try - { - Property target = (Property) object; - target.setValue((java.lang.String) value); - } catch (java.lang.Exception ex) - { - throw new IllegalStateException(ex.toString()); + desc.setValidator(fieldValidator); + //-- _value + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_value", "value", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Property target = (Property) object; + return target.getValue(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Property target = (Property) object; + target.setValue( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _value + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); } - } - - public java.lang.Object newInstance(java.lang.Object parent) - { - return null; - } - }; - desc.setHandler(handler); - desc.setRequired(true); - desc.setMultivalued(false); - addFieldDescriptor(desc); - - // -- validation code for: _value - fieldValidator = new org.exolab.castor.xml.FieldValidator(); - fieldValidator.setMinOccurs(1); - { // -- local scope - org.exolab.castor.xml.validators.StringValidator typeValidator; - typeValidator = new org.exolab.castor.xml.validators.StringValidator(); - fieldValidator.setValidator(typeValidator); - typeValidator.setWhiteSpace("preserve"); + desc.setValidator(fieldValidator); + //-- initialize element descriptors + } - desc.setValidator(fieldValidator); - // -- initialize element descriptors - } - // -----------/ - // - Methods -/ - // -----------/ + //-----------/ + //- Methods -/ + //-----------/ - /** - * Method getAccessMode. - * - * @return the access mode specified for this class. - */ - public org.exolab.castor.mapping.AccessMode getAccessMode() - { - return null; - } + /** + * Method getAccessMode. + * + * @return the access mode specified for this class. + */ + public org.exolab.castor.mapping.AccessMode getAccessMode( + ) { + return null; + } - /** - * Method getIdentity. - * - * @return the identity field, null if this class has no identity. - */ - public org.exolab.castor.mapping.FieldDescriptor getIdentity() - { - return super.getIdentity(); - } + /** + * Method getIdentity. + * + * @return the identity field, null if this class has no + * identity. + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity( + ) { + return super.getIdentity(); + } - /** - * Method getJavaClass. - * - * @return the Java class represented by this descriptor. - */ - public java.lang.Class getJavaClass() - { - return jalview.schemabinding.version2.Property.class; - } + /** + * Method getJavaClass. + * + * @return the Java class represented by this descriptor. + */ + public java.lang.Class getJavaClass( + ) { + return jalview.schemabinding.version2.Property.class; + } - /** - * Method getNameSpacePrefix. - * - * @return the namespace prefix to use when marshaling as XML. - */ - public java.lang.String getNameSpacePrefix() - { - return _nsPrefix; - } + /** + * Method getNameSpacePrefix. + * + * @return the namespace prefix to use when marshaling as XML. + */ + public java.lang.String getNameSpacePrefix( + ) { + return _nsPrefix; + } - /** - * Method getNameSpaceURI. - * - * @return the namespace URI used when marshaling and unmarshaling as XML. - */ - public java.lang.String getNameSpaceURI() - { - return _nsURI; - } + /** + * Method getNameSpaceURI. + * + * @return the namespace URI used when marshaling and + * unmarshaling as XML. + */ + public java.lang.String getNameSpaceURI( + ) { + return _nsURI; + } - /** - * Method getValidator. - * - * @return a specific validator for the class described by this - * ClassDescriptor. - */ - public org.exolab.castor.xml.TypeValidator getValidator() - { - return this; - } + /** + * Method getValidator. + * + * @return a specific validator for the class described by this + * ClassDescriptor. + */ + public org.exolab.castor.xml.TypeValidator getValidator( + ) { + return this; + } - /** - * Method getXMLName. - * - * @return the XML Name for the Class being described. - */ - public java.lang.String getXMLName() - { - return _xmlName; - } + /** + * Method getXMLName. + * + * @return the XML Name for the Class being described. + */ + public java.lang.String getXMLName( + ) { + return _xmlName; + } - /** - * Method isElementDefinition. - * - * @return true if XML schema definition of this Class is that of a global - * element or element with anonymous type definition. - */ - public boolean isElementDefinition() - { - return _elementDefinition; - } + /** + * Method isElementDefinition. + * + * @return true if XML schema definition of this Class is that + * of a global + * element or element with anonymous type definition. + */ + public boolean isElementDefinition( + ) { + return _elementDefinition; + } } diff --git a/src/jalview/schemes/AnnotationColourGradient.java b/src/jalview/schemes/AnnotationColourGradient.java index e975884..713e55d 100755 --- a/src/jalview/schemes/AnnotationColourGradient.java +++ b/src/jalview/schemes/AnnotationColourGradient.java @@ -23,6 +23,7 @@ package jalview.schemes; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.AnnotatedCollectionI; +import jalview.datamodel.Annotation; import jalview.datamodel.GraphLine; import jalview.datamodel.SequenceCollectionI; import jalview.datamodel.SequenceI; @@ -47,12 +48,18 @@ public class AnnotationColourGradient extends FollowerColourScheme GraphLine annotationThreshold; - float r1, g1, b1, rr, gg, bb, dr, dg, db; + float r1, g1, b1, rr, gg, bb; private boolean predefinedColours = false; private boolean seqAssociated = false; + /** + * false if the scheme was constructed without a minColour and maxColour used + * to decide if existing colours should be taken from annotation elements when + * they exist + */ + private boolean noGradient = false; IdentityHashMap seqannot = null; @Override @@ -70,12 +77,9 @@ public class AnnotationColourGradient extends FollowerColourScheme acg.rr = rr; acg.gg = gg; acg.bb = bb; - acg.dr = dr; - acg.dg = dg; - acg.db = db; acg.predefinedColours = predefinedColours; acg.seqAssociated = seqAssociated; - + acg.noGradient = noGradient; return acg; } @@ -102,6 +106,15 @@ public class AnnotationColourGradient extends FollowerColourScheme { annotationThreshold = annotation.threshold; } + // clear values so we don't get weird black bands... + r1 = 254; + g1 = 254; + b1 = 254; + rr = 0; + gg = 0; + bb = 0; + + noGradient = true; } /** @@ -126,6 +139,8 @@ public class AnnotationColourGradient extends FollowerColourScheme rr = maxColour.getRed() - r1; gg = maxColour.getGreen() - g1; bb = maxColour.getBlue() - b1; + + noGradient = false; } @Override @@ -232,71 +247,101 @@ public class AnnotationColourGradient extends FollowerColourScheme && annotation.annotations[j] != null && !jalview.util.Comparison.isGap(c)) { + Annotation aj = annotation.annotations[j]; + // 'use original colours' => colourScheme != null + // -> look up colour to be used + // predefined colours => preconfigured shading + // -> only use original colours reference if thresholding enabled & + // minmax exists + // annotation.hasIcons => null or black colours replaced with glyph + // colours + // -> reuse original colours if present + // -> if thresholding enabled then return colour on non-whitespace glyph - if (annotation.annotations[j].colour != null) - { - if (predefinedColours || annotation.hasIcons) - { - return annotation.annotations[j].colour; - } - } - else - { - if (predefinedColours) - { - return currentColour; - } - } if (aboveAnnotationThreshold == NO_THRESHOLD - || (annotationThreshold != null - && aboveAnnotationThreshold == ABOVE_THRESHOLD && annotation.annotations[j].value >= annotationThreshold.value) - || (annotationThreshold != null - && aboveAnnotationThreshold == BELOW_THRESHOLD && annotation.annotations[j].value <= annotationThreshold.value)) + || (annotationThreshold != null && (aboveAnnotationThreshold == ABOVE_THRESHOLD ? aj.value >= annotationThreshold.value + : aj.value <= annotationThreshold.value))) { - - float range = 1f; - if (thresholdIsMinMax - && annotation.threshold != null - && aboveAnnotationThreshold == ABOVE_THRESHOLD - && annotation.annotations[j].value >= annotation.threshold.value) - { - range = (annotation.annotations[j].value - annotation.threshold.value) - / (annotation.graphMax - annotation.threshold.value); - } - else if (thresholdIsMinMax && annotation.threshold != null - && aboveAnnotationThreshold == BELOW_THRESHOLD - && annotation.annotations[j].value >= annotation.graphMin) + if (predefinedColours && aj.colour != null) { - range = (annotation.annotations[j].value - annotation.graphMin) - / (annotation.threshold.value - annotation.graphMin); + currentColour = aj.colour; } - else + else if (annotation.hasIcons + && annotation.graph == AlignmentAnnotation.NO_GRAPH) { - range = (annotation.annotations[j].value - annotation.graphMin) - / (annotation.graphMax - annotation.graphMin); + if (aj.secondaryStructure > ' ' && aj.secondaryStructure != '.' + && aj.secondaryStructure != '-') + { + if (colourScheme != null) + { + currentColour = colourScheme.findColour(c, j, seq); + } + else + { + currentColour = annotation.annotations[j].secondaryStructure == 'H' ? jalview.renderer.AnnotationRenderer.HELIX_COLOUR + : annotation.annotations[j].secondaryStructure == 'E' ? jalview.renderer.AnnotationRenderer.SHEET_COLOUR + : jalview.renderer.AnnotationRenderer.STEM_COLOUR; + } + } + else + { + // + return Color.white; + } } - - if (colourScheme != null) + else if (noGradient) { - currentColour = colourScheme.findColour(c, j, seq); + if (colourScheme != null) + { + currentColour = colourScheme.findColour(c, j, seq); + } + else + { + if (aj.colour != null) + { + currentColour = aj.colour; + } + } } else { - dr = rr * range + r1; - dg = gg * range + g1; - db = bb * range + b1; + // calculate a shade + float range = 1f; + if (thresholdIsMinMax + && annotation.threshold != null + && aboveAnnotationThreshold == ABOVE_THRESHOLD + && annotation.annotations[j].value >= annotation.threshold.value) + { + range = (annotation.annotations[j].value - annotation.threshold.value) + / (annotation.graphMax - annotation.threshold.value); + } + else if (thresholdIsMinMax + && annotation.threshold != null + && aboveAnnotationThreshold == BELOW_THRESHOLD + && annotation.annotations[j].value >= annotation.graphMin) + { + range = (annotation.annotations[j].value - annotation.graphMin) + / (annotation.threshold.value - annotation.graphMin); + } + else + { + range = (annotation.annotations[j].value - annotation.graphMin) + / (annotation.graphMax - annotation.graphMin); + } + + int dr = (int) (rr * range + r1), dg = (int) (gg * range + g1), db = (int) (bb + * range + b1); + + currentColour = new Color(dr, dg, db); - currentColour = new Color((int) dr, (int) dg, (int) db); } } + if (conservationColouring) + { + currentColour = applyConservation(currentColour, j); + } } } - - if (conservationColouring) - { - currentColour = applyConservation(currentColour, j); - } - return currentColour; } diff --git a/src/jalview/structure/StructureMapping.java b/src/jalview/structure/StructureMapping.java index d2dcb34..e4749c9 100644 --- a/src/jalview/structure/StructureMapping.java +++ b/src/jalview/structure/StructureMapping.java @@ -20,7 +20,8 @@ */ package jalview.structure; -import jalview.datamodel.*; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.SequenceI; public class StructureMapping { @@ -98,4 +99,34 @@ public class StructureMapping } return -1; } + + /** + * transfer a copy of an alignment annotation row in the PDB chain coordinate + * system onto the mapped sequence + * + * @param ana + * @return the copy that was remapped to the mapped sequence + * @note this method will create a copy and add it to the dataset sequence for + * the mapped sequence as well as the mapped sequence (if it is not a + * dataset sequence). + */ + public AlignmentAnnotation transfer(AlignmentAnnotation ana) + { + AlignmentAnnotation ala_copy = new AlignmentAnnotation(ana); + SequenceI ds = sequence; + while (ds.getDatasetSequence() != null) + { + ds = ds.getDatasetSequence(); + } + ala_copy.remap(ds, mapping, 0, -1, 1); + ds.addAlignmentAnnotation(ala_copy); + if (ds != sequence) + { + // mapping wasn't to an original dataset sequence, so we make a copy on + // the mapped sequence too + ala_copy = new AlignmentAnnotation(ala_copy); + sequence.addAlignmentAnnotation(ala_copy); + } + return ala_copy; + } } diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index 4d94b2d..7a1b100 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -25,13 +25,15 @@ import jalview.api.StructureSelectionManagerProvider; import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.Annotation; +import jalview.datamodel.PDBEntry; import jalview.datamodel.SearchResults; import jalview.datamodel.SequenceI; +import jalview.io.FormatAdapter; import jalview.util.MessageManager; import java.io.PrintStream; import java.util.Enumeration; -import java.util.Hashtable; +import java.util.HashMap; import java.util.IdentityHashMap; import java.util.Vector; @@ -64,7 +66,36 @@ public class StructureSelectionManager } } - Hashtable mappingData = new Hashtable(); + /** + * map between the PDB IDs (or structure identifiers) used by Jalview and the + * absolute filenames for PDB data that corresponds to it + */ + HashMap pdbIdFileName = new HashMap(), + pdbFileNameId = new HashMap(); + + public void registerPDBFile(String idForFile, String absoluteFile) + { + pdbIdFileName.put(idForFile, absoluteFile); + pdbFileNameId.put(absoluteFile, idForFile); + } + + public String findIdForPDBFile(String idOrFile) + { + String id = pdbFileNameId.get(idOrFile); + return id; + } + + public String findFileForPDBId(String idOrFile) + { + String id = pdbIdFileName.get(idOrFile); + return id; + } + + public boolean isPDBFileRegistered(String idOrFile) + { + return pdbFileNameId.containsKey(idOrFile) + || pdbIdFileName.containsKey(idOrFile); + } private static StructureSelectionManager nullProvider = null; @@ -167,9 +198,33 @@ public class StructureSelectionManager } /** + * Import structure data and register a structure mapping for broadcasting + * colouring, mouseovers and selection events (convenience wrapper). + * + * @param sequence + * - one or more sequences to be mapped to pdbFile + * @param targetChains + * - optional chain specification for mapping each sequence to pdb + * (may be nill, individual elements may be nill) + * @param pdbFile + * - structure data resource + * @param protocol + * - how to resolve data from resource + * @return null or the structure data parsed as a pdb file + */ + synchronized public MCview.PDBfile setMapping(SequenceI[] sequence, + String[] targetChains, String pdbFile, String protocol) + { + return setMapping(true, sequence, targetChains, pdbFile, protocol); + } + + /** * create sequence structure mappings between each sequence and the given * pdbFile (retrieved via the given protocol). * + * @param forStructureView + * when true, record the mapping for use in mouseOvers + * * @param sequence * - one or more sequences to be mapped to pdbFile * @param targetChains @@ -181,7 +236,8 @@ public class StructureSelectionManager * - how to resolve data from resource * @return null or the structure data parsed as a pdb file */ - synchronized public MCview.PDBfile setMapping(SequenceI[] sequence, + synchronized public MCview.PDBfile setMapping(boolean forStructureView, + SequenceI[] sequence, String[] targetChains, String pdbFile, String protocol) { /* @@ -190,17 +246,28 @@ public class StructureSelectionManager */ MCview.PDBfile pdb = null; boolean parseSecStr=true; - for (SequenceI sq:sequence) + if (isPDBFileRegistered(pdbFile)) { - SequenceI ds = sq;while (ds.getDatasetSequence()!=null) { ds = ds.getDatasetSequence();}; - if (ds.getAnnotation()!=null) + for (SequenceI sq : sequence) { - for (AlignmentAnnotation ala:ds.getAnnotation()) + SequenceI ds = sq; + while (ds.getDatasetSequence() != null) + { + ds = ds.getDatasetSequence(); + } + ; + if (ds.getAnnotation() != null) { - // false if any annotation present from this structure - if (MCview.PDBfile.isCalcIdForFile(ala.getCalcId(), pdbFile)) + for (AlignmentAnnotation ala : ds.getAnnotation()) { - parseSecStr = false; + // false if any annotation present from this structure + // JBPNote this fails for jmol/chimera view because the *file* is + // passed, not the structure data ID - + if (MCview.PDBfile.isCalcIdForFile(ala, + findIdForPDBFile(pdbFile))) + { + parseSecStr = false; + } } } } @@ -208,7 +275,11 @@ public class StructureSelectionManager try { pdb = new MCview.PDBfile(true, parseSecStr, pdbFile, protocol); - + if (pdb.id != null && pdb.id.trim().length() > 0 + && FormatAdapter.FILE.equals(protocol)) + { + registerPDBFile(pdb.id.trim(), pdbFile); + } } catch (Exception ex) { ex.printStackTrace(); @@ -253,7 +324,7 @@ public class StructureSelectionManager boolean first = true; for (int i = 0; i < pdb.chains.size(); i++) { - PDBChain chain = ((PDBChain) pdb.chains.elementAt(i)); + PDBChain chain = (pdb.chains.elementAt(i)); if (targetChain.length() > 0 && !targetChain.equals(chain.id) && !infChain) { @@ -262,8 +333,8 @@ public class StructureSelectionManager // TODO: correctly determine sequence type for mixed na/peptide // structures AlignSeq as = new AlignSeq(sequence[s], - ((PDBChain) pdb.chains.elementAt(i)).sequence, - ((PDBChain) pdb.chains.elementAt(i)).isNa ? AlignSeq.DNA + pdb.chains.elementAt(i).sequence, + pdb.chains.elementAt(i).isNa ? AlignSeq.DNA : AlignSeq.PEP); as.calcScoreMatrix(); as.traceAlignment(); @@ -332,26 +403,30 @@ public class StructureSelectionManager index++; } while (index < maxChain.atoms.size()); - if (mappings == null) - { - mappings = new StructureMapping[1]; - } - else - { - StructureMapping[] tmp = new StructureMapping[mappings.length + 1]; - System.arraycopy(mappings, 0, tmp, 0, mappings.length); - mappings = tmp; - } - if (protocol.equals(jalview.io.AppletFormatAdapter.PASTE)) { pdbFile = "INLINE" + pdb.id; } - - mappings[mappings.length - 1] = new StructureMapping(sequence[s], + StructureMapping newMapping = new StructureMapping(sequence[s], pdbFile, pdb.id, maxChainId, mapping, mappingDetails.toString()); - maxChain.transferResidueAnnotation(mappings[mappings.length - 1]); + if (forStructureView) + { + + if (mappings == null) + { + mappings = new StructureMapping[1]; + } + else + { + StructureMapping[] tmp = new StructureMapping[mappings.length + 1]; + System.arraycopy(mappings, 0, tmp, 0, mappings.length); + mappings = tmp; + } + + mappings[mappings.length - 1] = newMapping; + } + maxChain.transferResidueAnnotation(newMapping); } // /////// @@ -855,10 +930,10 @@ public class StructureSelectionManager listeners.clear(); listeners = null; } - if (mappingData != null) + if (pdbIdFileName != null) { - mappingData.clear(); - mappingData = null; + pdbIdFileName.clear(); + pdbIdFileName = null; } if (sel_listeners != null) { @@ -902,4 +977,13 @@ public class StructureSelectionManager } } + public void registerPDBEntry(PDBEntry pdbentry) + { + if (pdbentry.getFile() != null + && pdbentry.getFile().trim().length() > 0) + { + registerPDBFile(pdbentry.getId(), pdbentry.getFile()); + } + } + } diff --git a/test/jalview/datamodel/AlignmentAnnotationTests.java b/test/jalview/datamodel/AlignmentAnnotationTests.java index 7df6255..f23b3d2 100644 --- a/test/jalview/datamodel/AlignmentAnnotationTests.java +++ b/test/jalview/datamodel/AlignmentAnnotationTests.java @@ -1,21 +1,26 @@ package jalview.datamodel; -import static org.junit.Assert.*; - -import java.awt.Frame; - -import javax.swing.JFrame; -import javax.swing.SwingWorker; - +import static org.junit.Assert.assertEquals; import jalview.analysis.AlignSeq; -import jalview.gui.AlignFrame; import jalview.io.AppletFormatAdapter; -import jalview.io.FormatAdapter; import org.junit.Test; public class AlignmentAnnotationTests { + @Test + public void testCopyConstructor() + { + SequenceI sq = new Sequence("Foo", "ARAARARARAWEAWEAWRAWEAWE"); + createAnnotation(sq); + AlignmentAnnotation alc, alo = sq.getAnnotation()[0]; + alc = new AlignmentAnnotation(alo); + for (String key : alo.getProperties()) + { + assertEquals("Property mismatch", alo.getProperty(key), + alc.getProperty(key)); + } + } /** * create some dummy annotation derived from the sequence * @@ -27,12 +32,13 @@ public class AlignmentAnnotationTests for (int i = 0; i < al.length; i++) { al[i] = new Annotation(new Annotation("" + sq.getCharAt(i), "", - (char) 0, (float) sq.findPosition(i))); + (char) 0, sq.findPosition(i))); } AlignmentAnnotation alan = new AlignmentAnnotation("For " + sq.getName(), "Fake alignment annot", al); // create a sequence mapping for the annotation vector in its current state alan.createSequenceMapping(sq, sq.getStart(), false); + alan.setProperty("CreatedBy", "createAnnotation"); sq.addAlignmentAnnotation(alan); } diff --git a/test/jalview/gui/PopupMenuTest.java b/test/jalview/gui/PopupMenuTest.java index ea1dfb0..1d219df 100644 --- a/test/jalview/gui/PopupMenuTest.java +++ b/test/jalview/gui/PopupMenuTest.java @@ -9,11 +9,15 @@ import jalview.datamodel.SequenceI; import jalview.io.AppletFormatAdapter; import jalview.util.MessageManager; +import java.awt.Component; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import javax.swing.JMenu; import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.JSeparator; import org.junit.Before; import org.junit.Test; @@ -121,9 +125,7 @@ public class PopupMenuTest public void testConfigureReferenceAnnotationsMenu() { JMenuItem menu = new JMenuItem(); - List seqs = new ArrayList(); - - seqs = parentPanel.getAlignment().getSequences(); + List seqs = parentPanel.getAlignment().getSequences(); // make up new annotations and add to dataset sequences // PDB.secondary structure on Sequence0 @@ -147,4 +149,197 @@ public class PopupMenuTest String expected = "
Add annotations for
JMOL/secondary structure
PBD/Temp
"; assertEquals(expected, menu.getToolTipText()); } + + /** + * Test for building menu options including 'show' and 'hide' annotation + * types. + */ + @Test + public void testBuildAnnotationTypesMenus() + { + JMenu showMenu = new JMenu(); + JMenu hideMenu = new JMenu(); + List seqs = parentPanel.getAlignment().getSequences(); + + // make up new annotations and add to sequences and to the alignment + + // PDB.secondary structure on Sequence0 + AlignmentAnnotation annotation = new AlignmentAnnotation( + "secondary structure", "", 0); + annotation.setCalcId("PDB"); + annotation.visible = true; + seqs.get(0).addAlignmentAnnotation(annotation); + parentPanel.getAlignment().addAnnotation(annotation); + + // JMOL.secondary structure on Sequence0 - hidden + annotation = new AlignmentAnnotation("secondary structure", "", 0); + annotation.setCalcId("JMOL"); + annotation.visible = false; + seqs.get(0).addAlignmentAnnotation(annotation); + parentPanel.getAlignment().addAnnotation(annotation); + + // Jpred.SSP on Sequence0 - hidden + annotation = new AlignmentAnnotation("SSP", "", 0); + annotation.setCalcId("JPred"); + annotation.visible = false; + seqs.get(0).addAlignmentAnnotation(annotation); + parentPanel.getAlignment().addAnnotation(annotation); + + // PDB.Temp on Sequence1 + annotation = new AlignmentAnnotation("Temp", "", 0); + annotation.setCalcId("PDB"); + annotation.visible = true; + seqs.get(1).addAlignmentAnnotation(annotation); + parentPanel.getAlignment().addAnnotation(annotation); + + /* + * Expect menu options to show "secondary structure" and "SSP", and to hide + * "secondary structure" and "Temp". Tooltip should be calcId. + */ + testee.buildAnnotationTypesMenus(showMenu, hideMenu, seqs); + + assertTrue(showMenu.isEnabled()); + assertTrue(hideMenu.isEnabled()); + + Component[] showOptions = showMenu.getMenuComponents(); + Component[] hideOptions = hideMenu.getMenuComponents(); + + assertEquals(4, showOptions.length); // includes 'All' and separator + assertEquals(4, hideOptions.length); + assertEquals("All", + ((JMenuItem) showOptions[0]).getText()); + assertTrue(showOptions[1] instanceof JPopupMenu.Separator); + assertEquals(JSeparator.HORIZONTAL, + ((JSeparator) showOptions[1]).getOrientation()); + assertEquals("secondary structure", + ((JMenuItem) showOptions[2]).getText()); + assertEquals("JMOL", ((JMenuItem) showOptions[2]).getToolTipText()); + assertEquals("SSP", ((JMenuItem) showOptions[3]).getText()); + assertEquals("JPred", ((JMenuItem) showOptions[3]).getToolTipText()); + + assertEquals("All", + ((JMenuItem) hideOptions[0]).getText()); + assertTrue(hideOptions[1] instanceof JPopupMenu.Separator); + assertEquals(JSeparator.HORIZONTAL, + ((JSeparator) hideOptions[1]).getOrientation()); + assertEquals("secondary structure", + ((JMenuItem) hideOptions[2]).getText()); + assertEquals("PDB", ((JMenuItem) hideOptions[2]).getToolTipText()); + assertEquals("Temp", ((JMenuItem) hideOptions[3]).getText()); + assertEquals("PDB", ((JMenuItem) hideOptions[3]).getToolTipText()); + } + + /** + * Test for building menu options with only 'hide' annotation types enabled. + */ + @Test + public void testBuildAnnotationTypesMenus_showDisabled() + { + JMenu showMenu = new JMenu(); + JMenu hideMenu = new JMenu(); + List seqs = parentPanel.getAlignment().getSequences(); + + // make up new annotations and add to sequences and to the alignment + + // PDB.secondary structure on Sequence0 + AlignmentAnnotation annotation = new AlignmentAnnotation( + "secondary structure", "", 0); + annotation.setCalcId("PDB"); + annotation.visible = true; + seqs.get(0).addAlignmentAnnotation(annotation); + parentPanel.getAlignment().addAnnotation(annotation); + + // PDB.Temp on Sequence1 + annotation = new AlignmentAnnotation("Temp", "", 0); + annotation.setCalcId("PDB"); + annotation.visible = true; + seqs.get(1).addAlignmentAnnotation(annotation); + parentPanel.getAlignment().addAnnotation(annotation); + + /* + * Expect menu options to hide "secondary structure" and "Temp". Tooltip + * should be calcId. 'Show' menu should be disabled. + */ + testee.buildAnnotationTypesMenus(showMenu, hideMenu, seqs); + + assertFalse(showMenu.isEnabled()); + assertTrue(hideMenu.isEnabled()); + + Component[] showOptions = showMenu.getMenuComponents(); + Component[] hideOptions = hideMenu.getMenuComponents(); + + assertEquals(2, showOptions.length); // includes 'All' and separator + assertEquals(4, hideOptions.length); + assertEquals("All", ((JMenuItem) showOptions[0]).getText()); + assertTrue(showOptions[1] instanceof JPopupMenu.Separator); + assertEquals(JSeparator.HORIZONTAL, + ((JSeparator) showOptions[1]).getOrientation()); + + assertEquals("All", ((JMenuItem) hideOptions[0]).getText()); + assertTrue(hideOptions[1] instanceof JPopupMenu.Separator); + assertEquals(JSeparator.HORIZONTAL, + ((JSeparator) hideOptions[1]).getOrientation()); + assertEquals("secondary structure", + ((JMenuItem) hideOptions[2]).getText()); + assertEquals("PDB", ((JMenuItem) hideOptions[2]).getToolTipText()); + assertEquals("Temp", ((JMenuItem) hideOptions[3]).getText()); + assertEquals("PDB", ((JMenuItem) hideOptions[3]).getToolTipText()); + } + + /** + * Test for building menu options with only 'show' annotation types enabled. + */ + @Test + public void testBuildAnnotationTypesMenus_hideDisabled() + { + JMenu showMenu = new JMenu(); + JMenu hideMenu = new JMenu(); + List seqs = parentPanel.getAlignment().getSequences(); + + // make up new annotations and add to sequences and to the alignment + + // PDB.secondary structure on Sequence0 + AlignmentAnnotation annotation = new AlignmentAnnotation( + "secondary structure", "", 0); + annotation.setCalcId("PDB"); + annotation.visible = false; + seqs.get(0).addAlignmentAnnotation(annotation); + parentPanel.getAlignment().addAnnotation(annotation); + + // PDB.Temp on Sequence1 + annotation = new AlignmentAnnotation("Temp", "", 0); + annotation.setCalcId("PDB2"); + annotation.visible = false; + seqs.get(1).addAlignmentAnnotation(annotation); + parentPanel.getAlignment().addAnnotation(annotation); + + /* + * Expect menu options to show "secondary structure" and "Temp". Tooltip + * should be calcId. 'hide' menu should be disabled. + */ + testee.buildAnnotationTypesMenus(showMenu, hideMenu, seqs); + + assertTrue(showMenu.isEnabled()); + assertFalse(hideMenu.isEnabled()); + + Component[] showOptions = showMenu.getMenuComponents(); + Component[] hideOptions = hideMenu.getMenuComponents(); + + assertEquals(4, showOptions.length); // includes 'All' and separator + assertEquals(2, hideOptions.length); + assertEquals("All", ((JMenuItem) showOptions[0]).getText()); + assertTrue(showOptions[1] instanceof JPopupMenu.Separator); + assertEquals(JSeparator.HORIZONTAL, + ((JSeparator) showOptions[1]).getOrientation()); + assertEquals("secondary structure", + ((JMenuItem) showOptions[2]).getText()); + assertEquals("PDB", ((JMenuItem) showOptions[2]).getToolTipText()); + assertEquals("Temp", ((JMenuItem) showOptions[3]).getText()); + assertEquals("PDB2", ((JMenuItem) showOptions[3]).getToolTipText()); + + assertEquals("All", ((JMenuItem) hideOptions[0]).getText()); + assertTrue(hideOptions[1] instanceof JPopupMenu.Separator); + assertEquals(JSeparator.HORIZONTAL, + ((JSeparator) hideOptions[1]).getOrientation()); + } } diff --git a/test/jalview/io/AnnotatedPDBFileInputTest.java b/test/jalview/io/AnnotatedPDBFileInputTest.java index 7e99409..30b6d55 100644 --- a/test/jalview/io/AnnotatedPDBFileInputTest.java +++ b/test/jalview/io/AnnotatedPDBFileInputTest.java @@ -23,7 +23,7 @@ public class AnnotatedPDBFileInputTest AlignmentI al; - String pdbStr = "examples/2GIS.pdb"; + String pdbStr = "examples/1gaq.txt"; String pdbId; @@ -68,7 +68,7 @@ public class AnnotatedPDBFileInputTest { System.out.println("CalcId: " + aa.getCalcId()); - assertTrue(MCview.PDBfile.isCalcIdForFile(aa.getCalcId(), pdbId)); + assertTrue(MCview.PDBfile.isCalcIdForFile(aa, pdbId)); } } } @@ -126,7 +126,7 @@ public class AnnotatedPDBFileInputTest public void testJalviewProjectRelocationAnnotation() throws Exception { - String inFile = "examples/2GIS.pdb"; + String inFile = "examples/1gaq.txt"; String tfile = File.createTempFile("JalviewTest", ".jvp") .getAbsolutePath(); AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded( @@ -160,7 +160,7 @@ public class AnnotatedPDBFileInputTest && MCview.PDBfile.isCalcIdHandled(ana.getCalcId())) { exists = true; - if (MCview.PDBfile.isCalcIdForFile(ana.getCalcId(), + if (MCview.PDBfile.isCalcIdForFile(ana, pdbentry.getId())) { found = true; diff --git a/test/jalview/structure/Mapping.java b/test/jalview/structure/Mapping.java new file mode 100644 index 0000000..8cf005b --- /dev/null +++ b/test/jalview/structure/Mapping.java @@ -0,0 +1,111 @@ +package jalview.structure; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.Annotation; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceI; + +import org.junit.Test; + +import MCview.PDBfile; + +public class Mapping +{ + + @Test + public void testPDBentryMapping() throws Exception + { + Sequence sq = new Sequence( + "1GAQ A subseq 126 to 219", + "EIVKGVCSNFLCDLQPGDNVQITGPVGKEMLMPKDPNATIIMLATGTGIAPFRSFLWKMFFEKHDDYKFNGLGWLFLGVPTSSSLLYKEEFGKM"); + Sequence sq1 = new Sequence(sq); + String inFile; + StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager(); + // Associate the 1GAQ pdb file with the subsequence 'imported' from another + // source + PDBfile pde = ssm.setMapping(true, new SequenceI[] + { sq }, new String[] + { "A" }, inFile = "examples/1gaq.txt", jalview.io.FormatAdapter.FILE); + assertTrue("PDB File couldn't be found", pde != null); + StructureMapping[] mp = ssm.getMapping(inFile); + assertTrue("No mappings made.", mp != null && mp.length > 0); + int nsecStr = 0, nsTemp = 0; + // test for presence of transferred annotation on sequence + for (AlignmentAnnotation alan : sq.getAnnotation()) + { + if (alan.hasIcons) + { + nsecStr++; + } + if (alan.graph == alan.LINE_GRAPH) + { + nsTemp++; + } + } + assertEquals( + "Only one secondary structure should be transferred to associated sequence.", + 1, nsecStr); + assertEquals( + "Only two line graphs should be transferred to associated sequence.", + 2, nsTemp); + // Now test the transfer function and compare annotated positions + for (StructureMapping origMap:mp) + { + if (origMap.getSequence()==sq) + { + assertEquals("Mapping was incomplete.", sq.getLength() - 1, + (origMap.getPDBResNum(sq.getEnd()) - origMap + .getPDBResNum(sq.getStart()))); + // sanity check - if this fails, mapping from first position in sequence + // we want to transfer to is not where we expect + assertEquals(1, origMap.getSeqPos(126)); + SequenceI firstChain = pde.getSeqs().get(0); + // Compare the annotated positions on the PDB chain sequence with the + // annotation on the associated sequence + for (AlignmentAnnotation alan : firstChain.getAnnotation()) + { + AlignmentAnnotation transfer = origMap.transfer(alan); + System.out.println("pdb:" + firstChain.getSequenceAsString()); + System.out.println("ann:" + alan.toString()); + System.out.println("pdb:" + sq.getSequenceAsString()); + System.out.println("ann:" + transfer.toString()); + + for (int p = 0, pSize = firstChain.getLength() - 1; p < pSize; p++) + { + // walk along the pdb chain's jalview sequence + int rseqpos; + int fpos = origMap.getSeqPos(rseqpos = firstChain + .findPosition(p)); + // only look at positions where there is a corresponding position in + // mapping + if (fpos < 1) + { + continue; + } + // p is index into PDB residue entries + // rseqpos is pdb sequence position for position p + // fpos is sequence position for associated position for rseqpos + int tanpos = sq.findIndex(fpos); + if (transfer.annotations.length <= tanpos) + { + // gone beyond mapping to the sequence + break; + } + Annotation a = transfer.annotations[sq.findIndex(fpos)], b = alan.annotations[p]; + assertEquals("Non-equivalent annotation element at " + p + "(" + + rseqpos + ")" + + " expected at " + fpos + " (alIndex " + + sq.findIndex(fpos) + ")", + a == null ? a : a.toString(), + b == null ? b : b.toString()); + System.out.print("(" + a + "|" + b + ")"); + } + + } + } + } + } + +}