- From: Anselm Baird_Smith <abaird@www43.inria.fr>
- Date: Tue, 5 Nov 1996 13:32:17 +0100 (MET)
- To: Dave Makower <davemak@pencom.com>
- Cc: www-jigsaw@w3.org
Dave Makower writes: > I'm observing some strange behavior with the FormCardHandler class. (Using > Jigsaw 1.0a3) > > I have an editor class which extends GenericResourceEditor. In the > defineCards() method, I call a method that has the following code: > > MyHandler handler = new MyHandler(target); > FormCardResource card = defineCard(handler, "MyCardName", "MyCardTitle"); > card.addButton("Generate"); > card.addButton("Delete"); > > Then, in the notifyButtonClick() method for the class MyHandler, I have the > following code: > > System.out.println("Got button click: \"" + label + "\"."); > > The strange thing is that no matter which button I click, the label seems > to be "Generate" -- never "Delete". That is, the println statement always > causes the following console output: > > Got button click: "Generate". > > Why is this? That's strange, here are a few hints to chase the bug: a) Check the generated HTML, and make sure the buttons have the correct labels there (it should be the case). b) Hack the FormCardResource.lookup method, and add some traces, here is a sample of what can be done: public boolean lookup(LookupState ls, LookupResult lr) throws HTTPException { if ( super.lookup(ls, lr) ) return true; String label = ls.getNextComponent() ; // Is this a valid button ? for (int i = 0 ; i < vbuttons.size() ; i++) { String button = (String) vbuttons.elementAt(i) ; System.out.println("FormCardResource: checking "+button+" against "+label); if ( button.equals(label) ) { // Notify the button click: try { System.out.println("FormcardResource: found "+label); handler.notifyButtonClick(label) ; } catch (FormProcessingException ex) { lr.setTarget(null); return false; } lr.setTarget(this); return true; } } // Unknown button: lr.setTarget(null); return true; } Let me know what happens with these traces... Anselm.
Received on Tuesday, 5 November 1996 07:32:34 UTC