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

UpoElement Class Reference

Inheritance diagram for UpoElement::

MachineElement AnimatedMachine ConnectorMachine List of all members.

Public Methods

 UpoElement ()
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

UpoElement::UpoElement   [inline]
 

00024 {
00025     int marginLF = 0;
00026     int marginUP = ImageElement.componentSize().height / 2;
00027     int marginRG = KeyComponent.componentSize().width  / 2;
00028     int marginDW = ImageElement.componentSize().height / 2;
00029     int machineW = 78;
00030     int machineH = 77;
00031 
00032     setSize(marginLF+machineW+marginRG, marginUP+machineH+marginDW);
00033 
00034     _props = new UpoProperties();
00035     _props.upoName = "threshold";
00036     _props.tagName = "";
00037     _props.tagValue = 0;
00038 
00039     _input = createInputSocket(marginLF+22, marginUP + machineH - marginDW - 2);
00040     _output = createOutputSocket(marginLF+22, 0);
00041     createPropertyComponent(_props, marginLF+8, marginUP + 40, 60);
00042     _key = createKeyComponent(marginLF+machineW-marginRG-2, marginUP + 10);
00043 
00044     setMachineImage(Images.upo, marginLF, marginUP, machineW, machineH);
00045 
00046     _conMgr = new ConnectorManager(this, _output);
00047     _conMgr.setColor(Color.blue);
00048 
00049     _tlFactory = null;
00050     _props.nameField.setEnabled(false);
00051     _props.valueField.setEnabled(false);
00052 }


Member Function Documentation

void UpoElement::componentAdded ContainerEvent    e [inline]
 

00054 {}

void UpoElement::componentRemoved ContainerEvent    e [inline]
 

00057 {
00058     if(e.getChild() == this) _conMgr.freeConnector();
00059 }

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

Reimplemented from ConnectorMachine.

00063 {
00064     if(_input.empty()) return null;
00065 
00066     _working = true;
00067     new Thread(this).start();
00068     _key.startAnimation();
00069     _key.joinAnimation();
00070 
00071     HxCorba.ImageRep result = _output.getImageRep();
00072     _output.removeElement();
00073     return result;
00074 }

void UpoElement::keyPressed   [inline, virtual]
 

Reimplemented from AnimatedMachine.

00078 {
00079     if(_working) return;
00080 
00081     if(_key.isTurned()) {
00082         _conMgr.freeConnector();
00083         _key.turnKey();
00084         return;
00085     }
00086 
00087     if(!_output.empty()) return;
00088 
00089     if(_input.empty()) { //create connector
00090         _conMgr.createConnector("Upo result");
00091         _key.turnKey();
00092         return;
00093     }
00094 
00095     // output.empty() and !input.empty()
00096     _working = true;
00097     _key.startAnimation();
00098     new Thread(this).start();
00099 }

void UpoElement::animationStep   [inline, virtual]
 

Reimplemented from AnimatedMachine.

00102 {}

boolean UpoElement::continueAnimation   [inline, virtual]
 

Reimplemented from AnimatedMachine.

00106 {
00107     return _working;
00108 }

void UpoElement::run   [inline]
 

00111 {
00112     try {
00113         HxCorba.ImageRep obj = _input.getImageRep();
00114         if(obj != null) {
00115             HxCorba.TagList tagList = createTagList(obj);
00116             HxCorba.ImageRep res = obj.unaryPixOp(_props.upoName, tagList);
00117             _output.setImageRep(res);
00118         }
00119     }catch(org.omg.CORBA.SystemException e) {
00120         ErrorStreamArea.println(""+e);
00121     }catch(HxCorba.ImageException e) {
00122         ErrorStreamArea.println(e.message);
00123     }
00124     _working = false;
00125 }

void UpoElement::doInit   [inline, protected]
 

Reimplemented from MachineElement.

00134 {
00135     _tlFactory = ServiceRepository.instance().getConstructor();
00136     if(_tlFactory != null) {
00137         _props.nameField.setEnabled(true);
00138         _props.valueField.setEnabled(true);
00139         _props.tagName = "level";
00140         _props.tagValue = 100;
00141     }
00142 }


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