Inheritance diagram for TVApp::

Public Methods | |
| void | handleExit () |
| This function is called by _bmenu if the associated menu item is selected. More... | |
| void | handleRegisterApp () |
| void | showImage () |
| void | doOneFrame (final int frameNr, boolean stopAfterwards) |
| void | handleStart () |
| Called when the user presses the start button in the GUI. More... | |
| void | handleStop () |
| Called when the user presses the stop button in the GUI. More... | |
| void | handleContinue () |
| Called when the user presses the continue button in the GUI. More... | |
| void | handleStep () |
| Called when the user presses the step button in the GUI. More... | |
| void | handleAppBrowser () |
| void | dragGestureRecognized (DragGestureEvent event) |
| void | dragDropEnd (DragSourceDropEvent event) |
| void | dragEnter (DragSourceDragEvent event) |
| void | dragOver (DragSourceDragEvent event) |
| void | dragExit (DragSourceEvent event) |
| void | dropActionChanged (DragSourceDragEvent event) |
Static Public Methods | |
| void | main (String[] args) |
| main is called when this is used as an application. More... | |
Protected Methods | |
| boolean | buildSample (JFrame parent, JApplet applet, String[] args) |
| Initialization. More... | |
|
|
main is called when this is used as an application. This function has to be overloaded in the "leaf node" application itself. Reimplemented from SampleApp.
|
|
|
This function is called by _bmenu if the associated menu item is selected.
00052 {
00053 unregisterApp();
00054 quitSample();
00055 }
|
|
|
00058 {
00059 registerApp(new TVServant());
00060 }
|
|
|
00063 {
00064 /*
00065 _viewer.removeAllObjects();
00066 _canvas = new CanvasCorbaImage(_im);
00067 _viewer.addObject(_canvas);
00068 */
00069 }
|
|
||||||||||||
|
00073 {
00074 _curFrame = frameNr;
00075 _stop = stopAfterwards;
00076 _statField.setText("running");
00077 _running = true;
00078
00079 if(_im != null)
00080 _im.removeRef();
00081
00082 try {
00083 _pixelCanvas.setPixels(_tvCapture.getRgb());
00084 }catch(org.omg.CORBA.SystemException e) {
00085 ErrorStreamArea.println(""+e);
00086 }
00087
00088 final SwingWorker worker = new SwingWorker() {
00089 public Object construct() {
00090 return null; // return value not used
00091 }
00092
00093 // Runs on the event-dispatching thread.
00094 public void finished() {
00095 showImage();
00096 _statField.setText("idle");
00097
00098 int nextFrame = _curFrame + _frameInc;
00099
00100 if (_stop) {
00101 _running = false;
00102 } else {
00103 long t = System.currentTimeMillis();
00104 t = (t - _startTime) / 1000;
00105 _nrDisplayed++;
00106 double fps = (double) _nrDisplayed / t;
00107 DecimalFormat df = new DecimalFormat("####.00");
00108 _fpsField.setText(" " + df.format(fps) + " fps");
00109 doOneFrame(nextFrame, _stop);
00110 }
00111 }
00112 }; // SwingWorker
00113 }
|
|
|
Called when the user presses the start button in the GUI.
00119 {
00120 _startTime = System.currentTimeMillis();
00121 _nrDisplayed = 0;
00122 doOneFrame(0, false);
00123 }
|
|
|
Called when the user presses the stop button in the GUI.
00129 {
00130 if (_stop)
00131 return;
00132 _stop = true;
00133 _statField.setText("stopping");
00134 }
|
|
|
Called when the user presses the continue button in the GUI.
00140 {
00141 if (_running)
00142 return;
00143 _startTime = System.currentTimeMillis();
00144 _nrDisplayed = 0;
00145 doOneFrame(_curFrame + _frameInc, false);
00146 }
|
|
|
Called when the user presses the step button in the GUI.
00152 {
00153 if (_running)
00154 return;
00155 doOneFrame(_curFrame + _frameInc, true);
00156 }
|
|
|
00160 {
00161 AppBrowser app = new AppBrowser(/*CorbaMediator.appMgr()*/);
00162 JDialog dlg = new JDialog(getParentFrame(), "App Browser", false);
00163 dlg.getContentPane().add(app);
00164 dlg.pack();
00165 dlg.setVisible(true);
00166 }
|
|
|
00170 {
00171 // a drag gesture has been initiated
00172 HxCorba.ImageRep image = null;
00173 String name = null;
00174 String type = HxCorba.ImageRepHelper.id();
00175 String ior = null;
00176
00177 name = "Frame"+_curFrame;
00178 image = _im;
00179
00180 if(image != null) {
00181 ior = CorbaMediator.instance().object_to_string(image);
00182 Transferable data = new ObjectTransfer(type, name, ior);
00183 event.getDragSource().startDrag(event, DragSource.DefaultMoveDrop, data, this);
00184 }
00185 }
|
|
|
00189 {}
|
|
|
00190 {}
|
|
|
00191 { }
|
|
|
00192 {}
|
|
|
00193 { }
|
|
||||||||||||||||
|
Initialization.
Reimplemented from SampleApp.
00205 {
00206 ErrorStreamArea err = new ErrorStreamArea(parent, 10, 80);
00207
00208 OutputStreamArea.println("Initializing CorbaMediator...");
00209 initCorbaMediator(args);
00210 setAdvancedLookupManager(parent);
00211
00212 HxCorba.Sizes imSizes = new HxCorba.Sizes(300, 200, 1);
00213 _tvCapture = ServiceRepository.instance().getTVCapture();
00214 if(_tvCapture != null) imSizes = _tvCapture.getSizes();
00215
00216 _pixelCanvas = new PixelSeqCanvas(imSizes.x, imSizes.y);
00217
00218 _viewer = ViewerFactory.makeBasicViewer();
00219
00220 _dragSource = new DragSource();
00221 _dragSource.createDefaultDragGestureRecognizer(((BasicViewer)_viewer).ed,
00222 DnDConstants.ACTION_COPY_OR_MOVE, this);
00223
00224 // Main panel
00225
00226 JPanel gui = new JPanel(new GridBagLayout());
00227
00228 //HX.addGridComp(this, _viewer, 0, 0, 1, 1,
00229 // GridBagConstraints.BOTH, 1.0, 1.0, 0, 3);
00230 HX.addGridComp(gui, _pixelCanvas, 0, 0, 1, 1,
00231 GridBagConstraints.BOTH, 1.0, 1.0, 0, 3);
00232
00233
00234 // Add button panel
00235
00236 JPanel butPanel = new JPanel();
00237
00238 JButton b1 = new JButton("Start");
00239 b1.setToolTipText("Start playing");
00240 b1.setEnabled(_tvCapture != null);
00241 b1.addActionListener(new AbstractAction() {
00242 public void actionPerformed(ActionEvent e) {
00243 handleStart();
00244 }});
00245 butPanel.add(b1);
00246
00247 JButton b2 = new JButton("Stop");
00248 b2.setToolTipText("Stop playing");
00249 b2.setEnabled(_tvCapture != null);
00250 b2.addActionListener(new AbstractAction() {
00251 public void actionPerformed(ActionEvent e) {
00252 handleStop();
00253 }});
00254 butPanel.add(b2);
00255
00256 JButton b4 = new JButton("Step");
00257 b4.setToolTipText("Step one frame");
00258 b4.setEnabled(_tvCapture != null);
00259 b4.addActionListener(new AbstractAction() {
00260 public void actionPerformed(ActionEvent e) {
00261 handleStep();
00262 }});
00263 butPanel.add(b4);
00264
00265 _statField = new JTextField("Status ", 6);
00266 _statField.setEditable(false);
00267 butPanel.add(_statField);
00268
00269 _fpsField = new JTextField("xxxxxx fps ", 6);
00270 _fpsField.setEditable(false);
00271 butPanel.add(_fpsField);
00272
00273 HX.addGridComp(gui, butPanel, 0, 1, 1, 1,
00274 GridBagConstraints.HORIZONTAL, 1.0, 0.0, 0, 3);
00275
00276
00277
00278 // Create ExtMenuBar:
00279
00280 _bmenu = new ExtMenuBar(this);
00281 _bmenu.addMenu("File");
00282 _bmenu.addMenuItem("File", "Exit", "handleExit");
00283
00284 if(isStandalone()) {
00285 _bmenu.addMenu("Tools");
00286 _bmenu.addMenuItem("Tools", "App Browser", "handleAppBrowser");
00287 _bmenu.addSeparator("Tools");
00288 _bmenu.addMenuItem("Tools", "Register App", "handleRegisterApp");
00289 }
00290
00291 parent.setJMenuBar(_bmenu);
00292 parent.getContentPane().add(gui, BorderLayout.CENTER);
00293
00294 parent.setSize(370, 350);
00295 parent.setLocation(0, 0);
00296
00297 OutputStreamArea.println("Done");
00298
00299 // Create OutFrame, for output and errors, also from C++
00300 // OutDialog out = new OutDialog(parent, 12, 4, 80);
00301 // out.setLocation(0, 428);
00302 // out.show();
00303
00304 return true;
00305 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001