TPTP 4.5.0 Platform Project
Internal API Specification

org.eclipse.tptp.platform.report.signals.internal
Class Signal

java.lang.Object
  extended by org.eclipse.tptp.platform.report.signals.internal.Signal
Direct Known Subclasses:
DisplayAsyncExecSignal, DisplayExecSignal, DisplaySyncExecSignal

Deprecated. As of TPTP 4.5.0, use the TPTP Business Intelligence and Reporting Tools (BIRT) reporting infrastructure (org.eclipse.tptp.platform.report.birt).

public class Signal
extends java.lang.Object

A Signal is made to prevent a variety of java's method at one time: when the signal is emitted. All the methods called (named 'slot' or 'receiver' must be connected (ie: registered) to the signals.

A Signal have a prototype: at emit time an array of arguments is provided. To be connected method must handle from zero to all arguments class. For documentation purpose and used to display messages, a message have a name. It's recommended this signal's name hold the signals prototype.

Signature are built using methods name and list of parameters class: "aMethod(int,MyClass,java.lang.String)" All class from package "java.lang.XXXX" can be printed as XXXX (ie String,Object)

Note for SWT's widget, a dispose listener is added to widget at connection time to disconnect it automatically at dispose time.

Example defining a signal:

 public class MyClass 
 {
   //the signal name holds signature
   public Signal a_signal = new Signal("valueChanged(int,String)");
 
   public void setValue( int _index, String _v )
   {
     //store and process value....
     //emit signal, first pack parameters
     // if params have one dimension use emit(Object)
     Object[] params = { new Integer(_index), _v };
     //second emit signals
     a_signal.emit( params );
   }
 }
 

Example defining a recevier (a fully normal class):

 public class AnotherClass
 {
   public void aMethod( int _a1, String _a1 )
   {
     // ...
   }
   public void updateData()
   {
     // ...
   }
 }
 

Example connecting Signal to slots:

 public class AClass
 {
   protected MyClass my_inst ;
   protected AnotherClass have_slots;
 
   public AClass()
   {
     my_inst = new MyClass();
     have_slots = new AnotherClass();
     //connecting first method (signature fully compliant)
     my_inst.a_signal.connect( have_slots, "aMethod(int,java.lang.String)" );
     //connecting an onther method ()
     my_inst.a_signal.connect( have_slots, "updateData()");
 
     //now each time signal is emitted, aMethod() and updateData() will be called
   }
 }
 


Nested Class Summary
protected static class Signal.Connection
          Deprecated.  
static interface Signal.IConnectionFactory
          Deprecated.  
static class Signal.MethodNotFoundException
          Deprecated. Used when an error occurs...
 
Field Summary
protected static Signal.IConnectionFactory connection_factory_
          Deprecated.  
 
Constructor Summary
Signal(java.lang.String _name)
          Deprecated. Create a signal.
 
Method Summary
 void clear()
          Deprecated. Clear the signal's list of receiver
 void connect(java.lang.Object _receiver, java.lang.Class _class, java.lang.String _method_name)
          Deprecated. Add a receiver, if the connection failed, a message is printed to System.err, no exception thrown.
 void connect(java.lang.Object _receiver, java.lang.String _method_name)
          Deprecated. Redefined to facilitate Signal usage.
 void connect(Signal _signal)
          Deprecated. Connect a signal to this signals.
 void connectChecked(java.lang.Object _receiver, java.lang.Class _receiver_class, java.lang.String _method_sgn)
          Deprecated. Connect a receiver to the signal, check is a given method name exists.
 void connectChecked(java.lang.Object _receiver, java.lang.String _method_sgn)
          Deprecated. Check connect to object _receiver, using receiver (if instance of Class) or receiver's class.
protected static Signal.Connection createConnection(java.lang.Object _o, java.lang.reflect.Method _m, java.lang.String _method_sgn)
          Deprecated.  
protected static java.lang.String[] DecompileSignature(java.lang.String _str)
          Deprecated. Analyse _str to extract a list of String, [0] is the method name all other indexes are arguments.
 void disconnect(java.lang.Object _receiver)
          Deprecated. Disconnect a receiver from the signal, all the connections defined for this receiver will be removed (@see disconnect#2)
 void disconnect(java.lang.Object _receiver, java.lang.String _signature)
          Deprecated. Disconnect a particular method for a given receiver
 void disconnect(Signal _signal)
          Deprecated. Disconnect a connected signal.
 void emit()
          Deprecated. Redefined or usability purpose, emit signal witout parameter.
 void emit(java.lang.Object _parameter)
          Deprecated. Redefined for usability purpose, strictly equals to Object pm[] = { _param }; emit( pm ); Usefull when signal have only one parameter.
 void emit(java.lang.Object[] _parameters)
          Deprecated. Emit signal, all receiver's connected method will be called.
protected  void emitSignal(java.lang.Object[] _parameters)
          Deprecated. derivative Signal's class can use this to send signals.
protected  java.lang.Class getClassOf(java.lang.Object _receiver, java.lang.Class _receiver_class)
          Deprecated. Return Class where the method is searched in...
protected  java.lang.reflect.Method getMethodFromSignature(java.lang.Object _receiver, java.lang.Class _class, java.lang.String _signature)
          Deprecated.  
 boolean haveReceiver()
          Deprecated.  
protected  void invokeConnection(java.lang.Object _receiver, java.lang.reflect.Method _method, java.lang.Object[] _params, java.lang.String _method_signature)
          Deprecated. Derivative Signal's class can reimplements this method to process connected method invokation.
static boolean isAllBlocked()
          Deprecated.  
 boolean isBlocked()
          Deprecated.  
static void setAllBlocked(boolean _b)
          Deprecated. Change global blocked status
 void setBlocked(boolean _b)
          Deprecated. Change blocked status for this signal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection_factory_

protected static Signal.IConnectionFactory connection_factory_
Deprecated. 
Constructor Detail

Signal

public Signal(java.lang.String _name)
Deprecated. 
Create a signal. It's recommended to use as the name of the signal the full signature this signal can emit, and a unic understandable name. Because name will be printed out each time error occurs on signal. example: public final Signal sgn_valueChanged = new Signal("valueChanged(String)");

Method Detail

DecompileSignature

protected static java.lang.String[] DecompileSignature(java.lang.String _str)
Deprecated. 
Analyse _str to extract a list of String, [0] is the method name all other indexes are arguments. ie: _str="aMethod(int,java.lang.String)" return { "aMathod", "int", "java.lang.String" }


haveReceiver

public boolean haveReceiver()
Deprecated. 
Returns:
true if signal contains one or more receivers

isBlocked

public boolean isBlocked()
Deprecated. 
Returns:
true if signal is blocked at instance level

isAllBlocked

public static boolean isAllBlocked()
Deprecated. 
Returns:
true if all signals are blocked

setBlocked

public void setBlocked(boolean _b)
Deprecated. 
Change blocked status for this signal


setAllBlocked

public static void setAllBlocked(boolean _b)
Deprecated. 
Change global blocked status


createConnection

protected static Signal.Connection createConnection(java.lang.Object _o,
                                                    java.lang.reflect.Method _m,
                                                    java.lang.String _method_sgn)
Deprecated. 

getClassOf

protected java.lang.Class getClassOf(java.lang.Object _receiver,
                                     java.lang.Class _receiver_class)
Deprecated. 
Return Class where the method is searched in... if _receiver_class is null, return _receiver if is an instance of Class, of receiver.getClass(). So _receiver and _receiver_class cannot be null at same time.

Returns:
Class instance to search method.

getMethodFromSignature

protected java.lang.reflect.Method getMethodFromSignature(java.lang.Object _receiver,
                                                          java.lang.Class _class,
                                                          java.lang.String _signature)
Deprecated. 
Returns:
method of _receiver as signature ("name(int,java.lang.String)" described. null if no signature found

connectChecked

public void connectChecked(java.lang.Object _receiver,
                           java.lang.Class _receiver_class,
                           java.lang.String _method_sgn)
                    throws Signal.MethodNotFoundException
Deprecated. 
Connect a receiver to the signal, check is a given method name exists. Remember receiver's method must be accessible from Signal class (ie: public). To connect to a static method of a class set _receiver as MyClass.class.

Parameters:
_receiver - the objet which will receive the call
_receiver_class - the class used to search method, if null receiver.getClass() is used (or receiver directly if it's an instanceof Class).
_method_name - method name and signature of _receiver to call
Throws:
Signal.MethodNotFoundException - if the method or the @param _method_name doesn't exist

connectChecked

public final void connectChecked(java.lang.Object _receiver,
                                 java.lang.String _method_sgn)
                          throws Signal.MethodNotFoundException
Deprecated. 
Check connect to object _receiver, using receiver (if instance of Class) or receiver's class. This method is redefined to facilitate usage of Signal class.

Throws:
Signal.MethodNotFoundException
See Also:
connectChecked( Object, Class, String )

connect

public void connect(java.lang.Object _receiver,
                    java.lang.Class _class,
                    java.lang.String _method_name)
Deprecated. 
Add a receiver, if the connection failed, a message is printed to System.err, no exception thrown. Remember receiver's method must be accessible from Signal class (ie: public). To connect signal to a static method, pass MyClass.class as _receiver parameter. If method is not visible in _receiver (ie inner anonymous class), you can set _class with a visible interface or class.


connect

public final void connect(java.lang.Object _receiver,
                          java.lang.String _method_name)
Deprecated. 
Redefined to facilitate Signal usage. same as connect( _receiver, null, _method_name )


connect

public void connect(Signal _signal)
Deprecated. 
Connect a signal to this signals. When this signals will be emitted, connected signals will emit too.


disconnect

public void disconnect(Signal _signal)
Deprecated. 
Disconnect a connected signal.


disconnect

public void disconnect(java.lang.Object _receiver)
Deprecated. 
Disconnect a receiver from the signal, all the connections defined for this receiver will be removed (@see disconnect#2)


disconnect

public void disconnect(java.lang.Object _receiver,
                       java.lang.String _signature)
Deprecated. 
Disconnect a particular method for a given receiver


clear

public void clear()
Deprecated. 
Clear the signal's list of receiver


emit

public void emit(java.lang.Object[] _parameters)
Deprecated. 
Emit signal, all receiver's connected method will be called. NB: if signal is blocked or all signal are blocked, emit does nothing.

Parameters:
_parameters - actual parameters for the call

emit

public final void emit(java.lang.Object _parameter)
Deprecated. 
Redefined for usability purpose, strictly equals to Object pm[] = { _param }; emit( pm ); Usefull when signal have only one parameter.

Parameters:
_parameters - s

emit

public final void emit()
Deprecated. 
Redefined or usability purpose, emit signal witout parameter.


emitSignal

protected void emitSignal(java.lang.Object[] _parameters)
Deprecated. 
derivative Signal's class can use this to send signals.

See Also:

invokeConnection

protected void invokeConnection(java.lang.Object _receiver,
                                java.lang.reflect.Method _method,
                                java.lang.Object[] _params,
                                java.lang.String _method_signature)
Deprecated. 
Derivative Signal's class can reimplements this method to process connected method invokation.

Parameters:
_receiver - object for method invocation.
_method - method to call.
_params - parameters suitable for this _method

TPTP 4.5.0 Platform Project
Internal API Specification