Thanks for looking into this.

Its superclass AbstractFormTable inherits from FormTable and contains no
Click specific code, only some shared application specific logic.


public class ObjectFormTable extends AbstractFormTable {
    private static final Logger log =
Logger.getLogger(ObjectFormTable.class);

    private List<AttributeDefinitionVO> attributes;
    private List<ModelObjectVO> objects;

    public ObjectFormTable(String name, MetaLayerVO metaLayer,
Set<ModelObjectVO> objects, AttributeDefinitionVO[] attributes, boolean
editable) {
        super(name, metaLayer, editable);
        this.objects = new ArrayList<ModelObjectVO>(objects);
        this.attributes = Arrays.asList(attributes);
        setClass("object_view");

        setupColumns();
        getForm().add( new HiddenField("metalayersymbol",
metaLayer.getSymbol()));

        getForm().setButtonAlign("right");
        getForm().setButtonStyle("buttons");
        getForm().add( new Submit("save", getMessage("button_submit"),
this, "onSave"));

    }

    protected void setupColumns() {
        int displayOptions = getDisplayOptions();

        MetaModelVO metaModelVO = getMetaModel(getCostModelId());
        
        FieldColumn nameC = new ObjectAttributeColumn(metaModelVO,
metaLayer, SystemAttributeDefinitionHelper.NAME, false);
        FieldColumn symbolC = new ObjectAttributeColumn(metaModelVO,
metaLayer, SystemAttributeDefinitionHelper.SYMBOL, false);
        switch (displayOptions) {
            case AppConstants.OBJECT_DISPLAY_OPTIONS_NAME_ONLY_INT:
                addColumn(nameC);
                break;
            case AppConstants.OBJECT_DISPLAY_OPTIONS_NAME_SYMBOL_INT:
                addColumn(nameC);
                addColumn(symbolC);
                break;
            case AppConstants.OBJECT_DISPLAY_OPTIONS_SYMBOL_ONLY_INT:
                addColumn(symbolC);
                break;
            case AppConstants.OBJECT_DISPLAY_OPTIONS_SYMBOL_NAME_INT:
                addColumn(symbolC);
                addColumn(nameC);
                break;
        }

        for (AttributeDefinitionVO attribute : attributes) {
            AbstractAttributeColumn c = new
ObjectAttributeColumn(metaModelVO, metaLayer, attribute, isEditable());
            if (attribute.isNumeric()) {
                c.setDataStyle("text-align", "right");
            }
            addColumn(c);
        }

    }

    public List getRowList() {
        return objects;
    }



    public boolean onSave() {
        log.info("onSave");
        return false;
    }


}












On Wed, 2009-04-22 at 22:51 +1000, Malcolm Edgar wrote:

> OK this looks fine, but not listener invoked. Can you post your
> ObjectFormTable source
> 
> On Wed, Apr 22, 2009 at 10:50 PM, WarnerJan Veldhuis
> <[email protected]> wrote:
> > Ok, then here you go, the entire logging:
> >
> > In case you wonder, I *do* have 9 forms on the screen, names form0 to
> > form9. Each form is a new instance of a FormTable, each with a new
> > instance of a save(submit)-button
> >
> >
> > [Click] [debug] POST http://10.0.0.100:18080/WebClientV2/editObjects.htm
> > [Click] [trace]    request param: SA_13_0=-
> > [Click] [trace]    request param: SA_13_1=-
> > [Click] [trace]    request param: SA_13_2=-
> > [Click] [trace]    request param: SA_13_3=-
> > [Click] [trace]    request param: SA_13_4=-
> > [Click] [trace]    request param: SA_13_5=-
> > [Click] [trace]    request param: SA_15_0=0,00
> > [Click] [trace]    request param: SA_15_1=0,00
> > [Click] [trace]    request param: SA_15_2=15.000,00
> > [Click] [trace]    request param: SA_15_3=7.000,00
> > [Click] [trace]    request param: SA_15_4=8.000,00
> > [Click] [trace]    request param: SA_15_5=7.500,00
> > [Click] [trace]    request param: SA_25_0=0,00
> > [Click] [trace]    request param: SA_25_1=0,00
> > [Click] [trace]    request param: SA_25_2=0,00
> > [Click] [trace]    request param: SA_25_3=0,00
> > [Click] [trace]    request param: SA_25_4=0,00
> > [Click] [trace]    request param: SA_25_5=0,00
> > [Click] [trace]    request param: ascending=
> > [Click] [trace]    request param: column=
> > [Click] [trace]    request param: form_name=form6_form
> > [Click] [trace]    request param: metalayersymbol=10
> > [Click] [trace]    request param: page=
> > [Click] [trace]    request param: save=Save
> > [Click] [trace]    invoked: EditObjectsPage.<<init>>
> > [Click] [trace]    invoked: EditObjectsPage.onSecurityCheck() : true
> > [Click] [trace]    invoked: EditObjectsPage.onInit()
> > [Click] [trace]    invoked: 'logoffLink' ActionLink.onInit()
> > [Click] [trace]    invoked: 'closeModelLink' ActionLink.onInit()
> > [Click] [trace]    invoked: 'logoffLink' ActionLink.onProcess() : true
> > [Click] [trace]    invoked: 'closeModelLink' ActionLink.onProcess() :
> > true
> > [Click] [trace]    invoked: Control listeners : true
> > [Click] [trace]    invoked: EditObjectsPage.onPost()
> > [Click] [trace]    invoked: EditObjectsPage.onRender()
> > [Click] [trace]    invoked: 'logoffLink' ActionLink.onRender()
> > [Click] [trace]    invoked: 'closeModelLink' ActionLink.onRender()
> > [Click] [trace]    invoked: 'form0' ObjectFormTable.onRender()
> > [Click] [trace]    invoked: 'form1' ObjectFormTable.onRender()
> > [Click] [trace]    invoked: 'form2' ObjectFormTable.onRender()
> > [Click] [trace]    invoked: 'form3' ObjectFormTable.onRender()
> > [Click] [trace]    invoked: 'form4' ObjectFormTable.onRender()
> > [Click] [trace]    invoked: 'form5' ObjectFormTable.onRender()
> > [Click] [trace]    invoked: 'form6' ObjectFormTable.onRender()
> > [Click] [trace]    invoked: 'form7' ObjectFormTable.onRender()
> > [Click] [trace]    invoked: 'form8' ObjectFormTable.onRender()
> > [Click] [trace]    invoked: 'form9' ObjectFormTable.onRender()
> > [Click] [info ]
> > renderTemplate: /editObjects.htm,/templates/base-template.htm - 48 ms
> > [Click] [trace]    invoked: 'logoffLink' ActionLink.onDestroy()
> > [Click] [trace]    invoked: 'closeModelLink' ActionLink.onDestroy()
> > [Click] [trace]    invoked: 'form0' ObjectFormTable.onDestroy()
> > [Click] [trace]    invoked: 'form1' ObjectFormTable.onDestroy()
> > [Click] [trace]    invoked: 'form2' ObjectFormTable.onDestroy()
> > [Click] [trace]    invoked: 'form3' ObjectFormTable.onDestroy()
> > [Click] [trace]    invoked: 'form4' ObjectFormTable.onDestroy()
> > [Click] [trace]    invoked: 'form5' ObjectFormTable.onDestroy()
> > [Click] [trace]    invoked: 'form6' ObjectFormTable.onDestroy()
> > [Click] [trace]    invoked: 'form7' ObjectFormTable.onDestroy()
> > [Click] [trace]    invoked: 'form8' ObjectFormTable.onDestroy()
> > [Click] [trace]    invoked: 'form9' ObjectFormTable.onDestroy()
> > [Click] [trace]    invoked: EditObjectsPage.onDestroy()
> > [Click] [info ] handleRequest:  /editObjects.htm - 496 ms
> >
> >
> >
> >
> > On Wed, 2009-04-22 at 22:36 +1000, Malcolm Edgar wrote:
> >> Hi Warner,
> >>
> >> The post parameters are important as they determine whether the action
> >> listener will be fired.
> >>
> >> regards Malcolm Edgar
> >>
> >> On Wed, Apr 22, 2009 at 10:25 PM, WarnerJan Veldhuis
> >> <[email protected]> wrote:
> >> > I am going insane. What in the sweet name of anything that's holy am I
> >> > doing wrong here?
> >> >
> >> > This is what my logging tells me (sorry for the long paste):
> >> >
> >> > [Click] [debug] POST http://10.0.0.100:18080/WebClientV2/editObjects.htm
> >> > <<snip>>
> >> > [Click] [trace]    request param: Whole lot of my params here
> >> > <</snip>>
> >> > [Click] [trace]    request param: ascending=
> >> > [Click] [trace]    request param: column=
> >> > [Click] [trace]    request param: form_name=form6_form
> >> > [Click] [trace]    request param: page=
> >> > [Click] [trace]    request param: save=Save
> >> > [Click] [trace]    invoked: EditObjectsPage.<<init>>
> >> > [Click] [trace]    invoked: EditObjectsPage.onSecurityCheck() : true
> >> > [Click] [trace]    invoked: EditObjectsPage.onInit()
> >> > [Click] [trace]    invoked: 'logoffLink' ActionLink.onInit()
> >> > [Click] [trace]    invoked: 'closeModelLink' ActionLink.onInit()
> >> > [Click] [trace]    invoked: 'logoffLink' ActionLink.onProcess() : true
> >> > [Click] [trace]    invoked: 'closeModelLink' ActionLink.onProcess() :
> >> > true
> >> > [Click] [trace]    invoked: Control listeners : true
> >> > [Click] [trace]    invoked: EditObjectsPage.onPost()
> >> > [Click] [trace]    invoked: EditObjectsPage.onRender()
> >> > [Click] [trace]    invoked: 'logoffLink' ActionLink.onRender()
> >> > [Click] [trace]    invoked: 'closeModelLink' ActionLink.onRender()
> >> > [Click] [trace]    invoked: 'form6' ObjectFormTable.onRender()
> >> > [Click] [info ]
> >> > renderTemplate: /editObjects.htm,/templates/base-template.htm - 16 ms
> >> > [Click] [trace]    invoked: 'logoffLink' ActionLink.onDestroy()
> >> > [Click] [trace]    invoked: 'closeModelLink' ActionLink.onDestroy()
> >> > [Click] [trace]    invoked: 'form6' ObjectFormTable.onDestroy()
> >> > [Click] [trace]    invoked: EditObjectsPage.onDestroy()
> >> > [Click] [info ] handleRequest:  /editObjects.htm - 2705 ms
> >> >
> >> > The line with "save=Save" tells me that the save button is clicked. I
> >> > don't see any hint anywhere that it hits the onSave() code, no log-line
> >> > (which I put there), no breakpoint, nothing. The ActionListener is
> >> > non-existent. The method ControlRegistry#hasActionEvents even returns
> >> > false. ControlRegistry#eventListenerList is null.
> >> >
> >> > Since my loginform works like a charm and is built the same way EXCEPT
> >> > for the use of FormTable, I am slowly getting frustrated why this
> >> > doesnt' work.
> >> >
> >> > Here's the line that adds the button to the form in the FormTable:
> >> >
> >> > getForm().add( new Submit("save", getMessage("button_submit"), this,
> >> > "onSave"));
> >> >
> >> > "this" actually refers to the FormTable, and it DOES contain the method
> >> > "boolean onSave(){}"
> >> >
> >> >
> >> > Please shed some light on this, cuz I am going bald soon...
> >> >
> >> > Cheers,
> >> >
> >> > WarnerJan
> >> >
> >> >
> >> >
> >> >
> >> > On Tue, 2009-04-21 at 11:44 +0200, Bob Schellink wrote:
> >> >> One other thing, if you set the app in trace mode Click will print out
> >> >> the events as they are processed.
> >> >>
> >> >> For example you should see something like:
> >> >>
> >> >>    [Click] [trace]    invoked: 'table' FormTable.onInit()
> >> >>    [Click] [trace]    invoked: 'table' FormTable.onProcess() : true
> >> >>
> >> >> meaning the FormTable.onInit was called and then its onProcess event
> >> >> was called.
> >> >>
> >> >> kind regards
> >> >>
> >> >> bob
> >> >>
> >> >>
> >> >> Bob Schellink wrote:
> >> >> > Hi WarnerJan,
> >> >> >
> >> >> >
> >> >> > WarnerJan Veldhuis wrote:
> >> >> >>
> >> >> >> I am having a fight with the FormTable and theSubmit that is on it. 
> >> >> >> This
> >> >> >> is the code I am using in my class that extends FormTable:
> >> >> >>
> >> >> >> public ObjectFormTable () {
> >> >> >> <snip>
> >> >> >>    setupColumns();//adding FieldColumns here
> >> >> >>    getForm().add( new Submit("save", getMessage("button_submit"), 
> >> >> >> this,
> >> >> >> "onSave"));
> >> >> >> <snip>
> >> >> >> }
> >> >> >>
> >> >> >> I also have the method onSave:
> >> >> >> public boolean onSave() {
> >> >> >> <snip>
> >> >> >> }
> >> >> >
> >> >> >
> >> >> > Is the onSave method declared on the ObjectFormTable or the Page?
> >> >> > According to your ObjectFormTable declaration the onSave method should
> >> >> > be declared on the ObjectFormTable itself. If you declare the onSave 
> >> >> > on
> >> >> > the Page that would be one reason why your breakpoint isn't hit.
> >> >> >
> >> >> > I also assume you use the FormTable internal Form and don't associate 
> >> >> > it
> >> >> > with an external Form?
> >> >> >
> >> >> > Let us know.
> >> >> >
> >> >> > kind regards
> >> >> >
> >> >> > bob
> >> >> >
> >> >
> >> >
> >> >
> >
> >
> >

WarnerJan Veldhuis

QPR CostControl BV
Clarissenhof 15
4133 AB Vianen
Tel: +31(0)347 355023
Helpsdesk: +31(0)347 355027


Reply via email to