Well, I've given thought to what Marvin has said above, and went back to the drawing board and revised my design needs some. I decided it would probably be easier to make a skimmed down Xith environment just to wrap a 'self-contained' editor in then get JAGaToo running how I wanted then without Xith at all. Either way, my editor will run in (some form of) a Xith env.
I looked though the UI/widgets provided but didn't see anything approaching a table, so I went back to JTable because that's what I knew. I've got TableCellRenderers for my InputAction derivative as well as for DeviceComponent, and a TableCellEditor for DeviceComponent. That cell editor passes out a JComponent that implements JAGaToo's InputListener, my InputSink. It does as described in previous posts, listens to but ignore's all input events, unless it has been enabled, in which case it stores the next event it hears and then disables itself again, allowing upstream code to retrieve the DeviceComponent representing the keypress or mouse click, and store it back into the InputBinding.
I've run it in it's own window along with a small (working) demo that allows user to walk around a cube, but there the real and theoretical issues arise. First, when I click the cell as if to edit it, it clears what was there (temporarily), but doesn't change color, the component I pass is supposed to have a different color so I could tell it was working. It also apparently doesn't receive events, the listener method is never fired. It didn't really occur to me, but I guess that's because it's listening for events on the demo, but I'm not clicking or pressing buttons in the demo? Last, I guess I need to alter the InputSink so it notifies the editor that it's done; say the enable method includes a reference back to the editor, an InputSinkListener if you will, so the InputSink can capture an input, disable itself, and then notify whoever cares that it has an event stored.
Anyway, I'm wondering if anyone has even approached this issue, letting users specify bindings by pressing the appropriate key/whatever, I plan to submit mine when I get it working, that way others can have it, and fix the oversights and assumptions I make. I find it hard to believe that I'm the first, but even so, if anyone could give me some hints on what I'm doing wrong, I'd appreciate it.
EditAlright, it would have saved me time if I had a) used my brain or b) paid attention to the color of the triangles in Eclipse: green means override. JComponent (which InputSink extends) has a setEnabled(boolean) method already, and I forgot to enable it because something else was doing it for me (meaning the enable on JComponenet). So I changed my method and then called it from the editor when it passes it out to a table, and low and behold, it works better. It also helped to call my editingStopped/Canceled listeners.
So I know the editor is having it's getValue method called as long as the input was done with the demo window in focus, but then I get an exception and can't see if the table it updating or not.
(I've excluded everything below the input firing)removeCellEditorListener()
java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
at java.util.AbstractList$Itr.next(AbstractList.java:343)
at sephirxv.input.binding.DeviceComponentTableCellEditor.stopCellEditing(DeviceComponentTableCellEditor.java:59)
at sephirxv.input.binding.DeviceComponentTableCellEditor.useInput(DeviceComponentTableCellEditor.java:79)
at sephirxv.input.binding.InputSink.onMouseButtonPressed(InputSink.java:68)
at org.jagatoo.input.devices.Mouse.fireOnMouseButtonPressed(Mouse.java:492)
at org.jagatoo.input.impl.lwjgl.LWJGLMouse.collectOrFireEvents(LWJGLMouse.java:199)
at org.jagatoo.input.impl.lwjgl.LWJGLMouse.update(LWJGLMouse.java:277)
at org.jagatoo.input.InputSystem.updateMouses(InputSystem.java:1125)
at org.jagatoo.input.InputSystem.update(InputSystem.java:1168)
I assume that it's conflicting with the editingStopped/Canceled notification of listeners (specifically the for(class instance : Vector<class>) iteration). It does the same thing if I just click the cell again, or another cell (cancelling the edit) or press an arrow to navigate to another cell, but not if I press Escape. I'm guessing it's the 'fail-fast' of lists because I'm removing an element while something else is iterating. So I need to delay the removal somehow.
Even if I comment out the listeners.remove(listener), no exception, but the model isn't updating. Anyway, anyone know why setting the color of my component doesn't affect how it's rendered? Does JComponent not even have a working paint method?
EditOkay, apparently asking on a forum is the only way for me to figure stuff out myself. I hadn't implemented the setValue method of my model. So as far as the JTable is concerned, it works (mostly). However, I have two issues. One is that even though I unbind any prior bindings to that DeviceComponent before I bind it to the new on, the table doesn't show any changes but to the current cell. I'm guessing it's a listener not setup somewhere. The other one is that when I edit a binding that should involves an unbinding, the demo starts moving by itself, and I can't stop it. Let me guess, need to edit a binding I'm not currently using, right?
BTW, if anyone thinks this belongs in one of the other categories, I'd probably agree. We left the realm of something internal to Xith a long time ago.