merge features/JAL-857_dynamic-example-files
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 3 Sep 2015 16:07:42 +0000 (17:07 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 3 Sep 2015 16:07:42 +0000 (17:07 +0100)
schemas/jalview.xsd
src/jalview/ext/jmol/PDBFileWithJmol.java
src/jalview/gui/Desktop.java
src/jalview/gui/Jalview2XML.java
src/jalview/gui/PDBSearchPanel.java
src/jalview/json/binding/biojson/v1/JalviewBioJsColorSchemeMapper.java
src/jalview/schemabinding/version2/.castor.cdr
src/jalview/schemabinding/version2/Viewport.java
src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java

index f60bb6a..850b223 100755 (executable)
                                                <xs:attribute name="fontName" type="xs:string" />
                                                <xs:attribute name="fontSize" type="xs:int" />
                                                <xs:attribute name="fontStyle" type="xs:int" />
+                                               <xs:attribute name="scaleProteinAsCdna" type="xs:boolean" use="optional" default="true" />
                                                <xs:attribute name="viewName" type="xs:string" />
                                                <xs:attribute name="sequenceSetId" type="xs:string" />
                                                <xs:attribute name="gatheredViews" type="xs:boolean" />
index cb19769..ddfa1b0 100644 (file)
@@ -45,7 +45,6 @@ import org.jmol.modelset.ModelSet;
 import org.jmol.modelsetbio.BioModel;
 import org.jmol.modelsetbio.BioPolymer;
 import org.jmol.viewer.Viewer;
-import org.openscience.jmol.app.JmolApp;
 
 /**
  * Import and process PDB files with Jmol
@@ -56,9 +55,6 @@ import org.openscience.jmol.app.JmolApp;
 public class PDBFileWithJmol extends AlignFile implements
         JmolStatusListener
 {
-
-  JmolApp jmolApp = null;
-
   Viewer viewer = null;
 
   public PDBFileWithJmol(String inFile, String type) throws IOException
@@ -73,7 +69,6 @@ public class PDBFileWithJmol extends AlignFile implements
 
   public PDBFileWithJmol()
   {
-    // TODO Auto-generated constructor stub
   }
 
   /**
@@ -84,18 +79,11 @@ public class PDBFileWithJmol extends AlignFile implements
   private Viewer getJmolData()
   {
     if (viewer == null)
-    { // note that -o -n -x are all implied // TODO check for Jmol 14.2
-      jmolApp = new JmolApp();
-      jmolApp.isDataOnly = true;
-      jmolApp.haveConsole = false;
-      jmolApp.haveDisplay = false;
+    {
       try
       {
         viewer = (Viewer) JmolViewer.allocateViewer(null, null, null, null,
                 null, "-x -o -n", this);
-        viewer.setScreenDimension(jmolApp.startupWidth,
-                jmolApp.startupHeight);
-        jmolApp.startViewer(viewer, null, false);
       } catch (ClassCastException x)
       {
         throw new Error(MessageManager.formatMessage("error.jmol_version_not_compatible_with_jalview_version", new String[]{JmolViewer.getJmolVersion()}),
index 39aa257..2a360cc 100644 (file)
@@ -3065,15 +3065,15 @@ public class Desktop extends jalview.jbgui.GDesktop implements
 
   }
 
-  // public static AlignFrame getCurrentAlignFrame()
-  // {
-  // return currentAlignFrame;
-  // }
-  //
-  // public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
-  // {
-  // Desktop.currentAlignFrame = currentAlignFrame;
-  // }
+  public static AlignFrame getCurrentAlignFrame()
+  {
+    return currentAlignFrame;
+  }
+
+  public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
+  {
+    Desktop.currentAlignFrame = currentAlignFrame;
+  }
 
 
 }
index 23b09de..2f90e91 100644 (file)
@@ -20,6 +20,7 @@
  */
 package jalview.gui;
 
+import jalview.api.ViewStyleI;
 import jalview.api.structures.JalviewStructureDisplayI;
 import jalview.bin.Cache;
 import jalview.datamodel.AlignedCodonFrame;
@@ -1149,6 +1150,7 @@ public class Jalview2XML
       view.setFontName(av.font.getName());
       view.setFontSize(av.font.getSize());
       view.setFontStyle(av.font.getStyle());
+      view.setScaleProteinAsCdna(av.getViewStyle().isScaleProteinAsCdna());
       view.setRenderGaps(av.isRenderGaps());
       view.setShowAnnotation(av.isShowAnnotation());
       view.setShowBoxes(av.getShowBoxes());
@@ -4194,6 +4196,9 @@ public class Jalview2XML
     af.viewport.setFont(
             new java.awt.Font(view.getFontName(), view.getFontStyle(), view
                     .getFontSize()), true);
+    ViewStyleI vs = af.viewport.getViewStyle();
+    vs.setScaleProteinAsCdna(view.isScaleProteinAsCdna());
+    af.viewport.setViewStyle(vs);
     // TODO: allow custom charWidth/Heights to be restored by updating them
     // after setting font - which means set above to false
     af.viewport.setRenderGaps(view.getRenderGaps());
index b31c637..4e23f57 100644 (file)
@@ -195,6 +195,7 @@ public class PDBSearchPanel extends GPDBSearchPanel
   public void loadSelectedPDBSequencesToAlignment()
   {
     // mainFrame.dispose();
+    disableActionButtons();
     StringBuilder selectedIds = new StringBuilder();
     HashSet<String> selectedIdsSet = new HashSet<String>();
     int pdbIdCol = PDBRestClient.getPDBIdColumIndex(wantedFields, false);
@@ -217,6 +218,35 @@ public class PDBSearchPanel extends GPDBSearchPanel
     seqFetcher.textArea.setText(ids);
     Thread worker = new Thread(seqFetcher);
     worker.start();
+    delayAndEnableActionButtons();
+
+  }
+
+  private void disableActionButtons()
+  {
+    btn_ok.setEnabled(false);
+    btn_back.setEnabled(false);
+    btn_cancel.setEnabled(false);
+  }
+
+  private void delayAndEnableActionButtons()
+  {
+    new Thread()
+    {
+      public void run()
+      {
+        try
+        {
+          Thread.sleep(1500);
+        } catch (InterruptedException e)
+        {
+          e.printStackTrace();
+        }
+        btn_ok.setEnabled(true);
+        btn_back.setEnabled(true);
+        btn_cancel.setEnabled(true);
+      }
+    }.start();
   }
 
   public static String getPDBIdwithSpecifiedChain(String pdbId,
index 094adad..92184ea 100644 (file)
@@ -22,7 +22,7 @@ public enum JalviewBioJsColorSchemeMapper
           "zappo", new ZappoColourScheme()), TAYLOR("Taylor", "taylor",
           new TaylorColourScheme()), NUCLEOTIDE("Nucleotide", "nucleotide",
           new NucleotideColourScheme()), PURINE_PYRIMIDINE(
-          "Purine/Pyrimidine", "purine", new PurinePyrimidineColourScheme()), HELIX_PROPENCITY(
+          "Purine/Pyrimidine", "purine", new PurinePyrimidineColourScheme()), HELIX_PROPENSITY(
           "Helix Propensity", "helix", new HelixColourScheme()), TURN_PROPENSITY(
           "Turn Propensity", "turn", new TurnColourScheme()), STRAND_PROPENSITY(
           "Strand Propensity", "strand", new StrandColourScheme()), BURIED_INDEX(
index e01bbd4..361fb7c 100644 (file)
@@ -1,4 +1,4 @@
-#Fri Jun 26 14:22:47 BST 2015
+#Thu Sep 03 10:55:37 BST 2015
 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
index 136a3b3..e3a19de 100644 (file)
@@ -332,6 +332,16 @@ public class Viewport implements java.io.Serializable {
     private boolean _has_fontStyle;
 
     /**
+     * Field _scaleProteinAsCdna.
+     */
+    private boolean _scaleProteinAsCdna = true;
+
+    /**
+     * keeps track of state for field: _scaleProteinAsCdna
+     */
+    private boolean _has_scaleProteinAsCdna;
+
+    /**
      * Field _viewName.
      */
     private java.lang.String _viewName;
@@ -631,6 +641,13 @@ public class Viewport implements java.io.Serializable {
 
     /**
      */
+    public void deleteScaleProteinAsCdna(
+    ) {
+        this._has_scaleProteinAsCdna= false;
+    }
+
+    /**
+     */
     public void deleteShowAnnotation(
     ) {
         this._has_showAnnotation= false;
@@ -1107,6 +1124,16 @@ public class Viewport implements java.io.Serializable {
     }
 
     /**
+     * Returns the value of field 'scaleProteinAsCdna'.
+     * 
+     * @return the value of field 'ScaleProteinAsCdna'.
+     */
+    public boolean getScaleProteinAsCdna(
+    ) {
+        return this._scaleProteinAsCdna;
+    }
+
+    /**
      * Returns the value of field 'sequenceSetId'.
      * 
      * @return the value of field 'SequenceSetId'.
@@ -1510,6 +1537,16 @@ public class Viewport implements java.io.Serializable {
     }
 
     /**
+     * Method hasScaleProteinAsCdna.
+     * 
+     * @return true if at least one ScaleProteinAsCdna has been adde
+     */
+    public boolean hasScaleProteinAsCdna(
+    ) {
+        return this._has_scaleProteinAsCdna;
+    }
+
+    /**
      * Method hasShowAnnotation.
      * 
      * @return true if at least one ShowAnnotation has been added
@@ -1834,6 +1871,16 @@ public class Viewport implements java.io.Serializable {
     }
 
     /**
+     * Returns the value of field 'scaleProteinAsCdna'.
+     * 
+     * @return the value of field 'ScaleProteinAsCdna'.
+     */
+    public boolean isScaleProteinAsCdna(
+    ) {
+        return this._scaleProteinAsCdna;
+    }
+
+    /**
      * Returns the value of field 'showAnnotation'.
      * 
      * @return the value of field 'ShowAnnotation'.
@@ -2382,6 +2429,18 @@ public class Viewport implements java.io.Serializable {
     }
 
     /**
+     * Sets the value of field 'scaleProteinAsCdna'.
+     * 
+     * @param scaleProteinAsCdna the value of field
+     * 'scaleProteinAsCdna'.
+     */
+    public void setScaleProteinAsCdna(
+            final boolean scaleProteinAsCdna) {
+        this._scaleProteinAsCdna = scaleProteinAsCdna;
+        this._has_scaleProteinAsCdna = true;
+    }
+
+    /**
      * Sets the value of field 'sequenceSetId'.
      * 
      * @param sequenceSetId the value of field 'sequenceSetId'.
index 0044f5b..cea458c 100644 (file)
@@ -1375,6 +1375,47 @@ public class ViewportDescriptor extends org.exolab.castor.xml.util.XMLClassDescr
             typeValidator.setMaxInclusive(2147483647);
         }
         desc.setValidator(fieldValidator);
+        //-- _scaleProteinAsCdna
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_scaleProteinAsCdna", "scaleProteinAsCdna", org.exolab.castor.xml.NodeType.Attribute);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Viewport target = (Viewport) object;
+                if (!target.hasScaleProteinAsCdna()) { return null; }
+                return (target.getScaleProteinAsCdna() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Viewport target = (Viewport) object;
+                    // if null, use delete method for optional primitives 
+                    if (value == null) {
+                        target.deleteScaleProteinAsCdna();
+                        return;
+                    }
+                    target.setScaleProteinAsCdna( ((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: _scaleProteinAsCdna
+        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);
         //-- _viewName
         desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_viewName", "viewName", org.exolab.castor.xml.NodeType.Attribute);
         desc.setImmutable(true);