How to know which List is concerned in a selectionChanged if there are more than one Lists? - lwuit

There are many List in my Form and they all call addSelectionListener. The problem is that the parameters of the abstract method selectionChanged are just (int oldSelected, int newSelected) ! So how to know which List was clicked ?

Use separate Listeners (one for each list)?

Related

What does the query method do in Flutter Flame game and what type is it supposed to be?

I'm trying to get the update function in Flame game to work. I have a global variable called newInstructions that's a list that gets updated by a separate function. I want the update function to check when there's a new addition to the list and call a function (populateInfo) with that list as input. After looking at some of the documentation, I've come up with what I think would be the correct code, but it keeps returning this error:
The method 'query' isn't defined by the type 'List'
I think that part of this might come from my not fully understanding what the update/query methods do. With that, what does the query method do and what type should it be? How would I go about changing my code to fix that error?
Here is the update function that I wrote:
#override
void update(double dt){
final instructions = newInstructions.query<List>();
populateInfo(instructions);
}
With that, what does the query method do and what type should it be?
query is a Flame specific method that is used on the OrderedSet in each component where the children are stored, it is used to get children of a specific type. For example to get all Player components:
children.query<Player>();
How would I go about changing my code to fix that error?
Since you want to react to when something is added the newInstructions list you shouldn't do this check in update since this method runs at least 60 times per seconds, it's better to just react once when there is a new instruction added.
This can be done in a few different ways, you could for example put the newInstructions list in a class that you then have an add method on that both adds the instruction to a list contained within the class, and also calls populateInfo. You could also wrap the list in a ChangeNotifier like this.

Attach method for events

I have a question about attach functions on controls.
For example, sap.m.Input has several attach* methods, one of them is attachLiveChange. The question is, does it exist a common attach method?
What am I trying to archive is, for example:
oInput.attach("LiveChange", (oEvent) => doSomething);
sap.ui.base.EventProvider has a method called attachEvent and attachEventOnce, most controls derive from the EventProvider class so you can use said methods to achieve your goal.
https://openui5.hana.ondemand.com/#/api/sap.ui.base.EventProvider/methods/attachEvent
https://openui5.hana.ondemand.com/#/api/sap.ui.base.EventProvider/methods/attachEventOnce

Delete a list of entity with RequestFactory (GWT)

How can I delete a list of entity with RequestFactory?
InstanceRequest<List<XProxy>, Void> remove();
Of course, this is not working, because the first parameter has to be like this: P extends BaseProxy; but is there a similar way?
I want to delete the selected entities of my CellTable from the database. And I am using MultiSelectionModel, and CheckboxCell.
An InstanceRequest means that the method is an instance method on the domain method for the first type argument (similar to looking for a remove() on a List in what you tried).
You have to use a Request and pass the List as an argument to the method. The presence of a #ServiceLocator on the RequestContext will tell RequestFactory whether to look for a static or an instance method.
Request<Void> remove(List<XProxy> list);

Symfony : Add widgets to already defined form

I would like to add widgets (checkboxes) in an already defined form (with configure method).
I can't add them in the definition of the form because the number of widgets varies (according to the object).
I see two ways of doing it :
Either pass a variable into the configure method of the form or maybe use embedded forms.
But which one is the right way ? Is there another solution ?
Thank you
The right way is to pass the object right into the options. In the form you can use the $this->getOption method to retrieve the passed options.
I Agree with Don Pinkster on passing option and use it to configure form in configure() method.
But if need it or can't get the value when instanciating the class, you can use from anywhere :
$form->getWidgetSchema()->offsetSet($name, $widget);
$form->getValidatorSchema()->offsetSet($name, $validator)
The fact you use embedded forms or widget will not change that much, as you can do this after the form is initially configured :
$form->embedForm($name, $form2);
For just one checkbox I don't see advantages in using embedded form.
In both cases, I suggest you do this in a public method from your form's class, to avoid exploding the form configuration in the action class or elsewhere.
Regards,

Gwt iterate on text controls in a Composite

Can one iterate over all the textbox controls defined in a composite widget?
As in I need to extract values of all textboxes to check if they exist - the textboxes should have some data in them.
So I was hoping to have a method like:
for(Widget w: this.getChildren)
{
//if widget is a textbox - check value
}
Composite class does not have a method like getChildren neither a method where I can get elements of a given class - or name and if I get all the elements using NodeList then I need to recursively go until I find a textbox. Is there a more appropriate way to do this?
As the author of the Composite subclass, you can enable this kind of behavior by implementing HasWidgets (or, more specifically, something like getWidgetIterator()).
There's no way to do this for an arbitrary Composite.