Revision 1949 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynform/AbeilleJDynForm.java

View differences:

AbeilleJDynForm.java
20 20
import org.gvsig.tools.dynform.spi.DynFormSPIManager;
21 21

  
22 22
import com.jeta.forms.components.panel.FormPanel;
23
import java.awt.event.ActionEvent;
24
import java.awt.event.ActionListener;
23 25
import java.io.File;
24 26
import java.util.ArrayList;
25 27
import java.util.List;
......
51 53
import org.gvsig.tools.dynobject.DynObject;
52 54
import org.gvsig.tools.resourcesstorage.ResourcesStorage;
53 55
import org.gvsig.tools.resourcesstorage.ResourcesStorage.Resource;
56
import org.gvsig.tools.script.Script;
54 57

  
55 58
@SuppressWarnings("UseSpecificCatch")
56 59
public class AbeilleJDynForm extends AbstractJDynForm implements JDynFormFieldListener {
......
350 353
    }
351 354
    
352 355
    private void bindUserCode(FormPanel form) {
353
//        for(Function fn : this.getUserFunctions()) {
354
//            String name = fn.name();
355
//            if( name.endsWith("_click") ) {
356
//                Component c = form.getComponentByName(name.substring(0, name.length()-6));
357
//                if( c instanceof JButton ) {
358
//                    JButton button = (JButton) c;
359
//                    final String fnName = fn.name();
360
//                    button.addActionListener(new ActionListener() {
361
//                        @Override
362
//                        public void actionPerformed(ActionEvent e) {
363
//                            callUserEvent(fnName, e);
364
//                        }
365
//                    });
366
//                }
367
//            }
368
//        }
369
//        
356
        Script theScript = this.getScript();
357
        if( theScript==null ) {
358
            return;
359
        }        
360
        List<String> names = theScript.getNames();
361
        if( names == null ) {
362
            return;
363
        }
364
        for(String name : names ) {
365
            if( name.endsWith("_click") ) {
366
                Component c = form.getComponentByName(name.substring(0, name.length()-6));
367
                if( c instanceof JButton ) {
368
                    JButton button = (JButton) c;
369
                    final String fnName = name;
370
                    button.addActionListener(new ActionListener() {
371
                        @Override
372
                        public void actionPerformed(ActionEvent e) {
373
                            callUserEvent(fnName, e);
374
                        }
375
                    });
376
                }
377
            }
378
        }
370 379
    }
371 380

  
372 381
    @Override

Also available in: Unified diff