Ignore:
Timestamp:
01/29/14 15:53:51 (10 years ago)
Author:
jts21
Message:

Add JSItem class, which like JSWidget is an item controlled by javascript, but with an Expeditee item rather than Swing.
TODO: Add the ability to set input and click handlers for the item.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/widgets/JSWidget.java

    r765 r784  
    55import java.util.List;
    66
    7 import javax.script.Bindings;
    87import javax.script.Invocable;
    9 import javax.script.ScriptContext;
    108import javax.script.ScriptEngine;
    119import javax.swing.JComponent;
     
    6361        this.container.add(component);
    6462        this.scriptEngine.put("component", this.component);
     63        this.scriptEngine.eval("save = " + this.save);
     64        this.scriptEngine.eval("load = " + this.load);
    6565        }
    6666       
     
    6969                                source.getData().get(1).replaceAll("\\\\n", "\n"),
    7070                                source.getData().get(2).replaceAll("\\\\n", "\n"));
    71                 this.scriptEngine.eval("load = " + this.load);
    7271                this.invocable.invokeFunction("load", (Object) args);
    7372        }
     
    9089                try {
    9190                        List<String> args = new LinkedList<String>();
    92                         this.scriptEngine.eval("save = " + this.save);
    9391                        this.invocable.invokeFunction("save", (Object)args);
    9492                        return args.toArray(new String[0]);
    95                 } catch(NullPointerException e) {
    96                         // caused when a null list is returned
    97                         return null;
    9893        } catch (Exception e) {
    9994                e.printStackTrace();
Note: See TracChangeset for help on using the changeset viewer.