Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[riena-dev] Comments on setDefaultButton(...)

Hi Frank and riena-dev,

I wanted to share some impressions about the
controller.setDefaultButton(...) / ridget.setDefaultButton(...) API --
and hear your feedback and ideas.

The API has not been used previously, as it was broken. I'm
experimenting with it in the context of making the Apply button in the
MasterDetails the default button. The "default" button is pressed
automatically, if you hit ENTER.

Here is what I've found:

1. We have SubModuleController.setDefaultButton(IActionRidget) and
IWindowRidget.setDefaultButton(Object widget)
>> I think it would be better to have IActionRidget in both cases

2. This only works when called from controller.afterBind() -- see
MasterDetailsSubModuleController2 for an example:

	public void afterBind() {
		super.afterBind();
		IMasterDetailsRidget master2 = getRidget(IMasterDetailsRidget.class,
"master2"); //$NON-NLS-1$
		IActionRidget actionApply = master2.getRidget(IActionRidget.class,
MasterDetailsComposite.BIND_ID_APPLY);
		setDefaultButton(actionApply);
	}

>> I think having to implement afterBind() just for this is clunky. Furthermore it does not work (see #3). Looking forward I think I would like it more, if it could work in configureRidgets() -- the SubModuleController should then do the necessary stuff in afterBind()

3. As you may know there can only be one default button per Shell
(=window). Currently we don't handle this correctly. If two
Controllers have a default button the last one will "win". Basically
we need to set the default button for the controller _each time_ the
module is activated.

4. Moving forward I would like to have several default buttons per
controller (think two MasterDetails ridgets). However I think that the
logic for this should not be tied to an individual ridget. It would
rather be something like a helper class that is set up in the
controller (example: DefaultButtonManager). For example if
MasterDetails #1 has the focus it would invoke
controller.setDefaultButton(apply1) -- if MasterDetails #2 gets the
focus it would invoke controller.setDefaultButton(apply2)   (assuming
we can implement this). The DefaultButtonManager could be configured
appropriately. Does this make sense?

Let me know what you think,
Elias.

-- 
Elias Volanakis | Technical Lead | http://eclipsesource.com
elias@xxxxxxxxxxxxxxxxx | +1 503 929 5537 | @evolanakis


Back to the top