From: Boudewijn R. <bo...@re...> - 2000-12-04 13:15:02
|
I've got the console working - even if I still have to hack Actions.py to be able to switch back to strong security, so now I've started to integrate my application interface in the console. However, this is a first for me, and I'm not an experienced Java developer, so I wanted to ask you all to look at my solution, and give criticism (like: this is a hack! It's unsupported! Don't do it! ;-). What I've done is this: All functionality to the core application goes via an adapter. There's already a Swing gui, so that was easy. I've added an extra parameter to the constructor of the console, where I put the adapter object: class Console (Object): def __init__(self, adapter=None, adapterName=""): "@sig public Console(Object adapter, java.lang.String adapterName)" self.locals = {} if adapter!=None: self.locals[adapterName]=adapter I've given the signature Object, so I can reuse the console for other adapters - this is the point where I'm not sure. I can access the interface from the Jython prompt, that's true. From Java I call it like this: Console console=new Console(managementGuiAdapter, "managementAdapter"); JScrollPane pane=new JScrollPane(console.getTextPane()); console.write("Tryllian AFC 1.5 Habitat Management Console\n" + "Uses Jython technology.\n" ,"output"); console.capturePythonOutput(); console.getTextPane().requestFocus(); console.newInput(); getContentPane().add(pane); And everything seems nice - but is it, really? Boudewijn Rempt | http://www.valdyas.org |