Inheritance diagram for GlobalOpElement::
Public Methods | |
GlobalOpElement (OperationDef op) | |
void | componentAdded (ContainerEvent e) |
void | componentRemoved (ContainerEvent e) |
HxCorba.ImageRep | computeResult () |
void | keyPressed () |
void | animationStep () |
boolean | continueAnimation () |
void | run () |
Protected Methods | |
void | doInit () |
|
00027 { 00028 _props = new GlobalOpProperties(op); 00029 00030 int halfImageHeight = ImageElement.componentSize().height / 2; 00031 int halfImageWidth = ImageElement.componentSize().width / 2; 00032 00033 int marginLF = 0; 00034 int marginUP = (_props.hasImageResult()) ? halfImageHeight : 0; 00035 int marginRG = KeyComponent.componentSize().width / 2; 00036 int marginDW = (_props.imageInputs() > 0) ? halfImageHeight : 0; 00037 int machineH = 77; 00038 int machineW = Math.max(50 + (2*_props.imageInputs()-1)*30, 78); 00039 00040 setSize(marginLF+machineW+marginRG, marginUP+machineH+marginDW); 00041 setMachineImage(createMachineImage(machineW, machineH), 00042 marginLF, marginUP, machineW, machineH); 00043 00044 _inputs = new ImageSocket[_props.imageInputs()]; 00045 for(int i=0; i<_inputs.length; i++) 00046 _inputs[i] = createInputSocket(marginLF+25+60*i-5, marginUP + machineH - marginDW - 2); 00047 00048 if(_props.hasImageResult()) 00049 _output = createOutputSocket(marginLF+machineW/2-halfImageWidth, 0); 00050 00051 _propComp = createPropertyComponent(_props, marginLF+machineW/2-30, marginUP + 40, 60); 00052 _key = createKeyComponent(marginLF+machineW-marginRG-2, marginUP + 10); 00053 00054 _conMgr = new ConnectorManager(this, _output); 00055 _conMgr.setColor(Color.magenta); 00056 00057 _propComp.setVisible(false); 00058 _key.setVisible(false); 00059 00060 _ops = null; 00061 } |
|
00063 {} |
|
00066 { 00067 if(e.getChild() == this) _conMgr.freeConnector(); 00068 } |
|
Reimplemented from ConnectorMachine.
00073 { 00074 for(int i=0; i<_inputs.length; i++) 00075 if(_inputs[i].empty()) return null; 00076 00077 _working = true; 00078 new Thread(this).start(); 00079 _key.startAnimation(); 00080 _key.joinAnimation(); 00081 00082 HxCorba.ImageRep result = _output.getImageRep(); 00083 _output.removeElement(); 00084 00085 return result; 00086 } |
|
Reimplemented from AnimatedMachine.
00090 { 00091 if(_working) return; 00092 00093 if(_key.isTurned()) { //there is a connector 00094 _conMgr.freeConnector(); 00095 _key.turnKey(); 00096 return; 00097 } 00098 00099 if(_output != null) 00100 if(!_output.empty()) return; 00101 00102 for(int i=0; i<_inputs.length; i++) { 00103 if(_inputs[i].empty()) { //create connector 00104 _conMgr.createConnector(_props.opName+" result"); 00105 _key.turnKey(); 00106 return; 00107 } 00108 } 00109 00110 // output.empty() and !input0.empty() and !input1.empty() 00111 _working = true; 00112 _key.startAnimation(); 00113 new Thread(this).start(); 00114 } |
|
Reimplemented from AnimatedMachine.
00118 { 00119 } |
|
Reimplemented from AnimatedMachine.
00123 { 00124 return _working; 00125 } |
|
00129 { 00130 try { 00131 _props.invoke(); 00132 } 00133 catch(org.omg.CORBA.SystemException e) { 00134 ErrorStreamArea.println(""+e); 00135 } 00136 _working = false; 00137 } |
|
Reimplemented from MachineElement.
00141 { 00142 _ops = ServiceRepository.instance().getGlobalOps(); 00143 if(_ops != null) { 00144 _key.setVisible(true); 00145 _propComp.setVisible(true); 00146 }else 00147 turnOff("No servers available"); 00148 00149 repaint(); 00150 } |