001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 * Created on Oct 6, 2009
021 * Author: Andreas Prlic
022 *
023 */
024
025package org.biojava.nbio.structure.align.gui.jmol;
026
027import java.util.Map;
028
029import javax.swing.JTextField;
030
031import org.jmol.api.JmolStatusListener;
032import org.jmol.c.CBK;
033import org.slf4j.Logger;
034import org.slf4j.LoggerFactory;
035
036public class MyJmolStatusListener implements JmolStatusListener {
037        private static final Logger logger = LoggerFactory.getLogger(MyJmolStatusListener.class);
038
039        JTextField status;
040        public MyJmolStatusListener(){
041        }
042
043        public void setTextField (JTextField statusField) {
044                status = statusField;
045        }
046
047        @Override
048        public String createImage(String arg0, String arg1, Object arg2, int arg3) {
049                return null; //Cancelled
050        }
051
052        @Override
053        public String eval(String arg0) {
054                logger.debug("eval {}",arg0);
055                return null;
056        }
057
058        @Override
059        public float[][] functionXY(String arg0, int arg1, int arg2) {
060                logger.debug("XY {} {} {}",arg0,arg1, arg2);
061                return null; //Ignore isosurface commands
062        }
063
064        @Override
065        public float[][][] functionXYZ(String arg0, int arg1, int arg2, int arg3) {
066                logger.debug("XYZ {} {} {} {}",arg0,arg1, arg2, arg3);
067                return null; //Ignore isosurface commands
068        }
069
070        @Override
071        public Map<String, Object> getRegistryInfo() {
072                return null; //Ignore
073        }
074
075        @Override
076        public void showUrl(String arg0) {
077                status.setText(arg0);
078
079        }
080
081        public void notifyCallback(int arg0, Object[] arg1) {
082                status.setText(arg0 +" " + arg1);
083
084        }
085
086        public boolean notifyEnabled(int arg0) {
087                return false;
088        }
089
090        @Override
091        public void setCallbackFunction(String arg0, String arg1) {
092                logger.debug("callback: {} {}", arg0, arg1);
093                status.setText(arg0 + " " + arg1);
094        }
095
096        public String dialogAsk(String arg0, String arg1) {
097                logger.debug("dialogAsk {} {}",arg0,arg1);
098                return null; //Ignore
099        }
100
101        public void handlePopupMenu(int arg0, int arg1) {
102                logger.debug("handlePopupMenu {} {}",arg0,arg1);
103        }
104
105        public void showConsole(boolean arg0) {
106                logger.debug("showConsole {}",arg0);
107        }
108
109
110
111        @Override
112        public void notifyCallback(CBK message, Object[] data) {
113        }
114
115        @Override
116        public boolean notifyEnabled(CBK type) {
117                return false;
118        }
119
120        @Override
121        public Map<String, Object> getJSpecViewProperty(String arg0) {
122                return null;
123        }
124
125
126        @Override
127        public int[] resizeInnerPanel(String data) {
128                return null;
129        }
130
131}