fileHandling.js
//Loads parsed compounds into the set viewers
Loads parsed compounds into the set viewers
Loads parsed compounds into the set viewers
function load_fxn(){
   var fID, fData, fType, x, y, origX, origY;
   for(var index=0; index<$$('uploadTable').count(); index++){
      fID = $$('uploadTable').getIdByIndex(index);
      fData = $$('uploadTable').getItem(fID).fileData;
      x = $$('uploadTable').getItem(fID).col, y = $$('uploadTable').getItem(fID).row;
      origX=$$('uploadTable').getItem(fID).oCol, origY=$$('uploadTable').getItem(fID).oRow;
      if (validCoordinates(x,y) && (x!=origX || y!=origY)){
         webix.message('New compound in viewer'+x+','+y);
         var viewer = $$('viewer'+x+','+y).getWindow();
         fType = getFileType(fID);
         console.log('Detected file type: '+fType);
         viewer.glviewer.clear();
         viewer.toDefaultDisp(); 
         setActiveViewer(x+','+y, viewer.getViewMode()); 
         viewer.fileToViewer(fData,fType); 
         if (origX!=0 && origY!=0) {
            var oldViewer = $$('viewer'+origX+','+origY).getWindow();
            oldViewer.glviewer.clear();
            oldViewer.toDefaultDisp();
         }
         $$('uploadTable').getItem(fID).oCol = x;
         $$('uploadTable').getItem(fID).oRow = y;
         console.log('Sent to '+$$('uploadTable').getItem(fID).oCol+
                     ','+$$('uploadTable').getItem(fID).oRow);
      }
      else if (x==origX || y==origY) {
         webix.message("Coordinates have not been changed for "+
                       $$('uploadTable').getItem(fID).fileName);
      }
      else{
         webix.message('NOT loading '+$$('uploadTable').getItem(fID).fileName+' to '+x+','+y);
      }
   }
}
function load_fxn ( ) { var fID , fData , fType , x , y , origX , origY ; for ( var index = 0 ; index < $$ ( 'uploadTable' ) . count ( ) ; index ++ ) { fID = $$ ( 'uploadTable' ) . getIdByIndex ( index ) ; fData = $$ ( 'uploadTable' ) . getItem ( fID ) . fileData ; x = $$ ( 'uploadTable' ) . getItem ( fID ) . col , y = $$ ( 'uploadTable' ) . getItem ( fID ) . row ; origX = $$ ( 'uploadTable' ) . getItem ( fID ) . oCol , origY = $$ ( 'uploadTable' ) . getItem ( fID ) . oRow ; if ( validCoordinates ( x , y ) && ( x != origX || y != origY ) ) { webix . message ( 'New compound in viewer' + x + ',' + y ) ; var viewer = $$ ( 'viewer' + x + ',' + y ) . getWindow ( ) ; fType = getFileType ( fID ) ; console . log ( 'Detected file type: ' + fType ) ; viewer . glviewer . clear ( ) ; viewer . toDefaultDisp ( ) ; setActiveViewer ( x + ',' + y , viewer . getViewMode ( ) ) ; viewer . fileToViewer ( fData , fType ) ; if ( origX != 0 && origY != 0 ) { var oldViewer = $$ ( 'viewer' + origX + ',' + origY ) . getWindow ( ) ; oldViewer . glviewer . clear ( ) ; oldViewer . toDefaultDisp ( ) ; } $$ ( 'uploadTable' ) . getItem ( fID ) . oCol = x ; $$ ( 'uploadTable' ) . getItem ( fID ) . oRow = y ; console . log ( 'Sent to ' + $$ ( 'uploadTable' ) . getItem ( fID ) . oCol + ',' + $$ ( 'uploadTable' ) . getItem ( fID ) . oRow ) ; } else if ( x == origX || y == origY ) { webix . message ( "Coordinates have not been changed for " + $$ ( 'uploadTable' ) . getItem ( fID ) . fileName ) ; } else { webix . message ( 'NOT loading ' + $$ ( 'uploadTable' ) . getItem ( fID ) . fileName + ' to ' + x + ',' + y ) ; } } }
Loads parsed compounds into the set viewers
Loads parsed compounds into the set viewers
//Only attempt load if the coordinates are valid AND the coordinates have been changed //Calls loading function for "viewer[x],[y]" defined in the iframe source html //REMOVE THE BELOW COMMAND IF YOU WANT TO DISPLAY MULTIPLE FILES AT ONCE //Resets the display tracking variables to the default //Syncs controls w/ the new settings //Sends file data for display //Clear old cell if the structure was loaded //set default display values in the old viewer