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 | ||
---|---|---|
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 |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/script/impl/DummyScript.java | ||
---|---|---|
1 | 1 |
|
2 | 2 |
package org.gvsig.tools.script.impl; |
3 | 3 |
|
4 |
import java.net.URI; |
|
4 |
import java.net.URL; |
|
5 |
import java.util.List; |
|
5 | 6 |
import org.gvsig.tools.script.Script; |
6 | 7 |
|
7 | 8 |
|
... | ... | |
48 | 49 |
} |
49 | 50 |
|
50 | 51 |
@Override |
51 |
public URI getURI() {
|
|
52 |
public URL getURL() {
|
|
52 | 53 |
return null; |
53 | 54 |
} |
55 |
|
|
56 |
@Override |
|
57 |
public List<String> getNames() { |
|
58 |
return null; |
|
59 |
} |
|
54 | 60 |
|
55 | 61 |
} |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/script/Script.java | ||
---|---|---|
1 | 1 |
package org.gvsig.tools.script; |
2 | 2 |
|
3 |
import java.net.URI; |
|
3 |
import java.net.URL; |
|
4 |
import java.util.List; |
|
4 | 5 |
|
5 | 6 |
/** |
6 | 7 |
* Represents a script with functions that can be invoked. |
... | ... | |
15 | 16 |
public String getName(); |
16 | 17 |
public String getCode(); |
17 | 18 |
public String getTypeName(); |
18 |
public URI getURI();
|
|
19 |
public URL getURL();
|
|
19 | 20 |
|
20 | 21 |
public void put(String name, Object value); |
21 | 22 |
|
... | ... | |
29 | 30 |
|
30 | 31 |
public void setCode(String code); |
31 | 32 |
|
33 |
/** |
|
34 |
* Returns the list of names defined in this script. |
|
35 |
* |
|
36 |
* Returns null if this functionality is not supported. |
|
37 |
* @return |
|
38 |
*/ |
|
39 |
public List<String> getNames(); |
|
32 | 40 |
} |
Also available in: Unified diff