// a new related method createUniqueName( Collection theseNot );
// @todo should select new receives
public void actionPerformed( ActionEvent e )
{
int numi, result;
Receiver rcv;
List collNewRcv, coll2;
Point2D anchor;
double d1;
Class c;
final List collTypes = Main.getReceiverTypes();
final JPanel msgPane = new JPanel( new SpringLayout() );
final NumberField ggNum = new NumberField( NumberSpace.createIntSpace( 1, 0x10000 ));
final JComboBox ggType = new JComboBox();
for( int i = 0; i < collTypes.size(); i++ ) {
ggType.addItem( collTypes.get( i ));
}
ggNum.setNumber( num );
if( type != null ) ggType.setSelectedItem( type );
msgPane.add( ggNum );
msgPane.add( ggType );
GUIUtil.makeCompactSpringGrid( msgPane, 1, 2, 4, 2, 4, 2 ); // #row #col initx inity padx pady
// HelpGlassPane.setHelp( msgPane, getValue( NAME ).toString() ); // EEE
result = JOptionPane.showOptionDialog( null, msgPane,
AbstractApplication.getApplication().getResourceString( "inputDlgNewReceivers" ),
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
null, queryOptions, queryOptions[ 1 ]);
if( result != 1 ) return;
num = ggNum.getNumber();
type = (StringItem) ggType.getSelectedItem();
numi = num.intValue();
try {
doc.bird.waitExclusive( Session.DOOR_RCV | Session.DOOR_GRP );
// we get a list of known receivers from the main class
// and create a new instance of the first receiver class
// in the list; in the future when there are more types
// apart from SigmaReceiver, we could display a selection
// dialog or the like...
c = Class.forName( type.getKey() );
collNewRcv = new ArrayList();
coll2 = doc.getReceivers().getAll();
for( int i = 0; i < numi; i++ ) {
d1 = ((double) i / (double) numi - 0.25) * Math.PI * -2;
// anchor = new Point2D.Double( 0.25 * (2.0 + Math.cos( d1 )), 0.25 * (2.0 + Math.sin( d1 )));
anchor = new Point2D.Double( 0.5 * + Math.cos( d1 ), 0.5 * Math.sin( d1 ));
rcv = (Receiver) c.newInstance();
rcv.setAnchor( anchor );
// rcv.setSize( new Dimension2DDouble( 0.5, 0.5 ));
rcv.setName( BasicSessionCollection.createUniqueName( Session.SO_NAME_PTRN,
new Object[] { new Integer( 1 ), Session.RCV_NAME_PREFIX, Session.RCV_NAME_SUFFIX },
coll2 ));
doc.getReceivers().getMap().copyContexts( this, MapManager.Context.FLAG_DYNAMIC,
MapManager.Context.NONE_EXCLUSIVE, rcv.getMap() );
collNewRcv.add( rcv );
coll2.add( rcv );
}
final BasicCompoundEdit edit = new BasicCompoundEdit( getValue( NAME ).toString() );
if( !doc.getSelectedGroups().isEmpty() ) {