001    /**
002     * Created by IntelliJ IDEA.
003     * User: Wei Wang
004     * Date: Dec 4, 2002
005     * Time: 8:51:17 PM
006     */
007    
008    package EVolve.visualization.XYViz.ValValViz;
009    
010    import EVolve.visualization.*;
011    import EVolve.visualization.Dimension;
012    import EVolve.Scene;
013    import javax.swing.*;
014    
015    public abstract class Metric extends ValueValueVisualization{
016        protected JTextField textInterval;
017    
018        public Metric() {
019            super();
020            interval = 1000;
021        }
022    
023        public Dimension[] createDimension() {
024            Dimension[] returnVal = new Dimension[3];
025            xAxis = new ValueDimension();
026            entityIdFilter = new ReferenceDimension();
027            filter2 = new ReferenceDimension();
028    
029            returnVal[0] = xAxis;
030            returnVal[1] = entityIdFilter;
031            returnVal[2] = filter2;
032    
033            return returnVal;
034        }
035    
036        public void makeSelection() { // nothing to be selected in this viz
037        }
038    
039        protected void updateConfiguration() {
040            try {
041                if (autoInterval != -1) {
042                    interval = autoInterval;
043                    autoInterval = -1;
044                } else
045                    interval = Integer.parseInt(textInterval.getText());
046    
047                super.updateConfiguration();
048            } catch (Exception e) {
049                Scene.showErrorMessage("Interval must be an integer");
050                configure();
051            }
052        }
053    
054        public Object clone() {
055            Metric o = (Metric)super.clone();
056            o.dimension[0] = o.xAxis;
057            o.dimension[1] = o.entityIdFilter;
058            o.dimension[2] = o.filter2;
059            return o;
060        }
061    }