Hi guys I was just wondering if this is an antipattern in wicket.
Instead of using anonymous Button classes, I created a Button Command Class
which I override.
I also created a class which indicates the button that I need.
I did this so I can be sure that I will be able to catch all the default
exceptions that exist.
Also any change in the button implementation I'll only change in one place.

Is this an anti pattern?>
I call it in my pages through this command 

add(new CCTIButton("ajax-button", this, buttonCommand));


public abstract class ButtonCommand implements Serializable {
        public abstract void onSubmit();
        public abstract void onError();
}


public class CCTIButton extends IndicatingAjaxButton {
        
        private ButtonCommand buttonCommand;
        
        public CCTIButton(String id, Form form, ButtonCommand buttonCommand) {
                super(id, form);
                this.buttonCommand = buttonCommand;
        }
        
        @Override
        protected void onSubmit(AjaxRequestTarget target, Form form) {
                // TODO Auto-generated method stub
                try {
                        buttonCommand.onSubmit();
                } catch(Exception e) {
                        
                }
                        
        }
        
        @Override
        protected void onError(AjaxRequestTarget target, Form form) {
                // TODO Auto-generated method stub
                buttonCommand.onError();
        }
-- 
View this message in context: 
http://www.nabble.com/Button-Command-Design-Pattern-tf4504772.html#a12847315
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to