View Javadoc

1   package org.catacomb.druid.gui.base;
2   
3   import java.awt.Color;
4   import java.awt.image.BufferedImage;
5   
6   import org.catacomb.druid.swing.DBorderLayout;
7   import org.catacomb.graph.gui.DataDisplay;
8   import org.catacomb.interlish.structure.GraphicsView;
9   import org.catacomb.interlish.structure.ModeController;
10  import org.catacomb.interlish.structure.RangeWatcher;
11  import org.catacomb.util.AWTUtil;
12  
13  public class DruDataDisplay extends DruBorderPanel implements GraphicsView {
14      static final long serialVersionUID = 1001;
15  
16      DataDisplay dataDisplay;
17  
18  
19  
20      public DruDataDisplay(int w, int h) {
21  
22          dataDisplay = new DataDisplay(w, h);
23  
24          addDComponent(dataDisplay, DBorderLayout.CENTER);
25      }
26  
27  
28      public void setBg(Color c) {
29          super.setBg(c);
30          dataDisplay.setBg(c);
31      }
32  
33  
34      public void setModeController(ModeController mc) {
35          mc.addModeSettable(dataDisplay);
36      }
37  
38  
39      public void viewChanged() {
40          dataDisplay.viewChanged();
41      }
42  
43  
44  
45      public void attachGraphicsController(Object obj) {
46          dataDisplay.attach(obj);
47      }
48  
49  
50      public void setXAxisLabel(String s) {
51          dataDisplay.setXAxisLabel(s);
52      }
53  
54      public void setXAxis(String s, double xl, double xh) {
55          dataDisplay.setXAxis(s, xl, xh);
56      }
57  
58      public void setYAxisLabel(String s) {
59          dataDisplay.setYAxisLabel(s);
60      }
61  
62      public void setYAxis(String s, double yl, double yh) {
63          dataDisplay.setYAxis(s, yl, yh);
64      }
65  
66  
67      public void setXRange(double low, double high) {
68          dataDisplay.setXRange(low, high);
69      }
70  
71      public void setYRange(double low, double high) {
72          dataDisplay.setYRange(low, high);
73      }
74  
75      public void setLimits(double[] xyxy) {
76          dataDisplay.setLimits(xyxy);
77      }
78  
79  
80      public double[] getXRange() {
81          return dataDisplay.getXRange();
82      }
83  
84      public double[] getYRange() {
85          return dataDisplay.getYRange();
86      }
87  
88      public void setFixedAspectRatio(double ar) {
89          dataDisplay.setFixedAspectRatio(ar);
90      }
91  
92      public void reframe() {
93          dataDisplay.reframe();
94      }
95  
96  
97      public void setColorRange(double cmin, double cmax) {
98          dataDisplay.setColorRange(cmin, cmax);
99      }
100 
101     public void setColorTable(Color[] ac) {
102         dataDisplay.setColorTable(ac);
103     }
104 
105 
106     public void addRangeWatcher(RangeWatcher rw) {
107         dataDisplay.addRangeWatcher(rw);
108     }
109 
110 
111     public void setSize(int w, int h) {
112         dataDisplay.setPrefSize(w, h);
113         setPreferredSize(w, h);
114         revalidate();
115 
116     }
117 
118 
119     public void repaintAll() {
120         dataDisplay.repaintAll();
121     }
122 
123     public void syncSizes() {
124         dataDisplay.syncSizes();
125     }
126 
127     public BufferedImage getSnapshot() {
128         // BufferedImage img = AWTUtil.getBufferedImage(getGUIPeer());
129         BufferedImage img = AWTUtil.getBufferedImage(dataDisplay);
130         return img;
131     }
132 
133 
134     /*
135     public void setXRange(double xmin, double xmax) {
136        dataDisplay.setXRange(xmin, xmax);
137     }
138 
139 
140     public void setYRange(double ymin, double ymax) {
141        dataDisplay.setYRange(ymin, ymax);
142     }
143     */
144 
145 }