Re: Action and ActionConvertors

[email protected] Tue, 1 Mar 2005 15:13:07 -0500 (EST)
Newsgroups gmane.comp.embedded.carlsbad-cubes
Message-ID <Pine.GSO.4.40.0503011510100.26231-100000@omicron.cse.ohio-state.edu>
>Sorry if this is clumsy but why don't implement the actions in your
>wizard base (the usual, public action-way)? Just call a function
>(abstract or default implementation) which is the overiden by your
>wizared-enabled classes? You may then have/use your getters just through
>some kind of delegation to these public actions...
>
>
>Frank

hey that's what i ended up doing, and it's quite clean..

	public Action aContinue = new AbstractAction() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
            showNextCard();
        }
    };

    public Action aBack = new AbstractAction() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
            showPreviousCard();
        }
    };

and

    public void setBack (Action act){
        aBack = act;
    }

    public void setContinueAction (Action act)
    {
        aContinue = act;
    }

all in the WizardBase.. the subclasses that want to override just call these setters with
the actions they want..

The only problem is, this must be done in the constructor of the subclasses, otherwise SwiX
will pick up the default implementations from the base class using Reflection.

Is this what you meant?


-- 
Nandan Bagchee

Excuse me, but what the hell?

	-- Slava Pestov, on seeing:
  	   FunctorParser parser = new FunctorParser();
  	   BinaryFunctor toggleOther = parser.parseBinary("x.setEnabled(!x.isEnabled())",
	   							   JButton.class, ActionEvent.class);