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

BpoElement Class Reference

Inheritance diagram for BpoElement::

MachineElement AnimatedMachine ConnectorMachine List of all members.

Public Methods

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

BpoElement::BpoElement   [inline]
 

00025 {
00026     int marginLF = 0;
00027     int marginUP = ImageElement.componentSize().height / 2;
00028     int marginRG = KeyComponent.componentSize().width  / 2;
00029     int marginDW = ImageElement.componentSize().height / 2;
00030     int machineW = 126;
00031     int machineH = 77;
00032 
00033     setSize(marginLF+machineW+marginRG, marginUP+machineH+marginDW);
00034     setMachineImage(Images.bpo, marginLF, marginUP, machineW, machineH);
00035 
00036     _props = new BpoProperties();
00037     _props.bpoName = "add";
00038     _props.tagName = "";
00039     _props.tagValue = 0;
00040 
00041     _input0 = createInputSocket(marginLF+18, marginUP + machineH - marginDW - 2);
00042     _input1 = createInputSocket(marginLF+76, marginUP + machineH - marginDW - 2);
00043     _output = createOutputSocket(marginLF+46, 0);
00044     createPropertyComponent(_props, marginLF+32, marginUP + 40, 60);
00045     _key = createKeyComponent(marginLF+machineW-marginRG-2, marginUP + 10);
00046 
00047     _conMgr = new ConnectorManager(this, _output);
00048     _conMgr.setColor(Color.red);
00049 
00050     _tlFactory = null;
00051     _props.nameField.setEnabled(false);
00052     _props.valueField.setEnabled(false);
00053 }


Member Function Documentation

void BpoElement::componentAdded ContainerEvent    e [inline]
 

00055 {}

void BpoElement::componentRemoved ContainerEvent    e [inline]
 

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

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

Reimplemented from ConnectorMachine.

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

void BpoElement::keyPressed   [inline, virtual]
 

Reimplemented from AnimatedMachine.

00081 {
00082     if(_working) return;
00083 
00084     if(_key.isTurned()) { //there is a connector
00085         _conMgr.freeConnector();
00086         _key.turnKey();
00087         return;
00088     }
00089 
00090     if(!_output.empty()) return;
00091 
00092     if(_input0.empty() || _input1.empty()) { //create connector
00093         _conMgr.createConnector("Bpo result");
00094         _key.turnKey();
00095         return;
00096     }
00097 
00098     // output.empty() and !input0.empty() and !input1.empty()
00099     _working = true;
00100     _key.startAnimation();
00101     new Thread(this).start();
00102 }

void BpoElement::animationStep   [inline, virtual]
 

Reimplemented from AnimatedMachine.

00106 {
00107 }

boolean BpoElement::continueAnimation   [inline, virtual]
 

Reimplemented from AnimatedMachine.

00111 {
00112     return _working;
00113 }

void BpoElement::run   [inline]
 

00117 {
00118     try {
00119         HxCorba.ImageRep obj = _input0.getImageRep();
00120         HxCorba.ImageRep arg = _input1.getImageRep();
00121         if((obj != null) && (arg != null)) {
00122             HxCorba.TagList tagList = createTagList(obj);
00123             HxCorba.ImageRep res = obj.binaryPixOp(arg, _props.bpoName, tagList);
00124             _output.setImageRep(res);
00125         }
00126     }catch(org.omg.CORBA.SystemException e) {
00127         ErrorStreamArea.println(""+e);
00128     }catch(HxCorba.ImageException e) {
00129         ErrorStreamArea.println(e.message);
00130     }
00131     _working = false;
00132 }

void BpoElement::doInit   [inline, protected]
 

Reimplemented from MachineElement.

00136 {
00137     _tlFactory = ServiceRepository.instance().getConstructor();
00138     if(_tlFactory != null) {
00139         _props.nameField.setEnabled(true);
00140         _props.valueField.setEnabled(true);
00141     }
00142 }


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