Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 335841 - RienaCollectionRidget
Summary: RienaCollectionRidget
Status: NEW
Alias: None
Product: Riena
Classification: RT
Component: ridget (show other bugs)
Version: 2.0.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-31 08:27 EST by Christian Campo CLA
Modified: 2011-04-13 05:16 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Campo CLA 2011-01-31 08:27:56 EST
This is a draft idea for a new feature in Riena. Currently the programmer always gets one ridget at a time in the controller. It would be nice if he could get a CollectionRidget or MetaRidget which contains multiple Ridgets.

This CollectionRidget (not sure it is the right name) could then be used in two ways.
a) you can iterate over its content and inspect the individual ridgets (pretty much the same as the IRidgetContainer)
b) you can perform a single action which is automatically performed on all ridgets in the collection. As an extension when a action is not feaseable for a certain ridget it would be ignored for that action.

The way to get such a collectionridget could be masked ridgetname, some meta language to filter by attribute or type, regex (still undecided)

An example

	coll1 = getCollectionRidget("all visible ridgets");
	coll1.setVisible(false);
	
	coll2 = getCollectionRidget("all text fields");
	coll2.setMandatory(true);
	
	coll3 = getCollectionRidget("all childs of master");
	coll3.setDisabled(true);
	
	coll4 = getCollectionRidget("all ridgets");
	coll4.updateFromModel();
Comment 1 Steffen Kriese CLA 2011-04-13 03:49:14 EDT
+1 

A common use case in a Riena application is a SubModuleView with a an address that consists of firstname, lastname, street, zip textfields. Those textfields belong together, but we can't treat them as one collectionRidget/metaRidget. So I would like to have compound ridgetIds that consist of a prefix and the ridgetId identifying the single ridget. Then we could get a set of ridgets by a prefix in the SubModuleController that belong together:

SubModuleView

public void createPartControl(Composite parent){
UIControlsFactory.createText(parent, SWT.BORDER, "address.firstName");
UIControlsFactory.createText(parent, SWT.BORDER, "address.lastName");
}

SubModuleController:

public void configureRidgets(){
 CollectionRidget address = getRidgetMatching("address.*");
 address.setOutputOnly(true);
}

Now we could easily add  or remove marker to a set of Ridgets.
Comment 2 Christian Campo CLA 2011-04-13 05:14:21 EDT
looks good. 

However we have to make a list of APIs that we want to consider in the CollectionRidget. Does it implement IRidget or does it need to implement IMarkableRidget (which includes setOutputOnly) but is not implemented by all ridgets.

Or should we have CollectionRidget and CollectionMarkableRidget implementation with different API ?

Can you iterate over such a collection ?

Can you specify a desired type or interface ?

CollectionRidget collection = getRidgetMatching("address.*",ITextRidget.class);

I also think that it would be better to have a ICollectionRidget rather than a CollectionRidget in the return type of getRidgetMatching 

and it should be getRidgetsMatching (plural) since we return a collection.