Horus Doc || Java GUI Reference || Doxygen's quick Index  

TVElement Class Reference

Inheritance diagram for TVElement::

MachineElement AnimatedMachine ConnectorMachine List of all members.

Public Methods

 TVElement ()
void componentAdded (ContainerEvent e)
void componentRemoved (ContainerEvent e)
HxCorba.ImageRep computeResult ()
void keyPressed ()
void animationStep ()
boolean continueAnimation ()
void run ()

Protected Methods

void doInit ()

Constructor & Destructor Documentation

TVElement::TVElement   [inline]
 

00025 {
00026     int marginLF = ImageElement.componentSize().width  / 2;
00027     int marginUP = 0;
00028     int marginRG = KeyComponent.componentSize().width  / 2;
00029     int marginDW = 0;
00030     int machineW = 83;
00031     int machineH = 128;
00032 
00033     setSize(marginLF+machineW+marginRG, marginUP+machineH+marginDW);
00034     setMachineImage(Images.tvtuner, marginLF, marginUP, machineW, machineH);
00035 
00036     _output = createOutputSocket(0, 75);
00037     _key = createKeyComponent(marginLF+machineW-marginRG-2, marginUP + 70);
00038     _display = createDisplayComponent(marginLF+11, marginUP+68, 68, 51);
00039 
00040     _conMgr = new ConnectorManager(this, _output);
00041     _conMgr.setColor(Color.gray);
00042 
00043     _imgFactory = null;
00044     _tvCapture = null;
00045     _key.setVisible(false);
00046     _display.setVisible(false);
00047 }


Member Function Documentation

void TVElement::componentAdded ContainerEvent    e [inline]
 

00049 {}

void TVElement::componentRemoved ContainerEvent    e [inline]
 

00052 {
00053     if(e.getChild() == this) _conMgr.freeConnector();
00054 }

HxCorba.ImageRep TVElement::computeResult   [inline, virtual]
 

Reimplemented from ConnectorMachine.

00058 {
00059     _working = true;
00060     new Thread(this).start();
00061     _key.startAnimation();
00062     _key.joinAnimation();
00063 
00064     HxCorba.ImageRep result = _output.getImageRep();
00065     _output.removeElement();
00066 
00067     return result;
00068 }

void TVElement::keyPressed   [inline, virtual]
 

Reimplemented from AnimatedMachine.

00072 {
00073     if(_displayFrame.isShowing()) _displayFrame.show();
00074 
00075     new DisplayThread().start();
00076 }

void TVElement::animationStep   [inline, virtual]
 

Reimplemented from AnimatedMachine.

00080 {
00081 }

boolean TVElement::continueAnimation   [inline, virtual]
 

Reimplemented from AnimatedMachine.

00085 {
00086     return _working;
00087 }

void TVElement::run   [inline]
 

00090 {
00091     try {
00092         HxCorba.Sizes sizes = _tvCapture.getSizes();
00093         int[] pixels = _tvCapture.getRgb();
00094         HxCorba.ImageRep res = _imgFactory.fromJavaRgb(
00095             HxCorba.ImageSignature.SIG2DVEC3BYTE, sizes, pixels);
00096         _output.setImageRep(res);
00097         _display.showImage(res);
00098     }catch(org.omg.CORBA.SystemException e) {
00099         ErrorStreamArea.println(""+e);
00100     }
00101 
00102     _working = false;
00103 }

void TVElement::doInit   [inline, protected]
 

Reimplemented from MachineElement.

00149 {
00150     _tvCapture = ServiceRepository.instance().getTVCapture();
00151     if(_tvCapture == null) {
00152         turnOff("Cannot find TVCapture server");
00153     }
00154     else {
00155         _key.setVisible(true);
00156         HxCorba.Sizes sizes = _tvCapture.getSizes();
00157         _pixelCanvas = new PixelSeqCanvas(sizes.x, sizes.y);
00158         _displayFrame = new JFrame("TV");
00159         _displayFrame.getContentPane().add(_pixelCanvas);
00160         _displayFrame.setSize(sizes.x, sizes.y+25);
00161 
00162         _imgFactory = ServiceRepository.instance().getConstructor();
00163         if(_imgFactory != null) {
00164             _conMgr.createConnector("TV tuner");
00165             _display.setVisible(true);
00166         }
00167     }
00168 }


The documentation for this class was generated from the following file:
Generated on Mon Jan 27 15:11:28 2003 for JavaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001