public void mouseClicked( MouseEvent e )
{
Receiver rcv;
Rectangle2D clipRect;
ReceiverEditor rcvEdit;
AbstractWindow rcvEditFrame;
List coll;
PerformableEdit edit;
if( !doc.bird.attemptShared( Session.DOOR_RCV, 250 )) return;
try {
if( doc.getSelectedReceivers().isEmpty() ) {
if( e.getClickCount() == 2 ) { // double click creates new Receiver
rcv = createReceiver( screenToVirtual( e.getPoint() ));
if( rcv != null ) {
coll = doc.getSelectedReceivers().getAll();
coll.add( rcv );
edit = new EditSetSessionObjects( this, doc.getMutableSelectedReceivers(), coll );
doc.getUndoManager().addEdit( edit.perform() );
clipRect = rcv.getBounds();
updateSurfacePaneImage( clipRect );
updateReceiverShapes();
redrawImage();
repaint( virtualToScreenClip( clipRect ));
}
}
} else { // items have been selected
if( e.getClickCount() == 2 && doc.getSelectedReceivers().size() == 1 ) { // double click opens editor
rcv = (Receiver) doc.getSelectedReceivers().get( 0 );
final Class clz = rcv.getDefaultEditor();
final Constructor cons = clz.getConstructor( new Class[] { Session.class });
rcvEdit = (ReceiverEditor) cons.newInstance( new Object[] { doc }); // XXX deligate to SurfacePaneFrame
rcvEdit.init( rcv );
rcvEditFrame = rcvEdit.getView();
rcvEditFrame.setVisible( true );
rcvEditFrame.toFront();
showCursorTab();
}
}