How to set up binding for an array with Gwittir and GWT? - gwt

I have an list of checkboxes on a GWT widget using Gwittir. I want to bind these checkbox values in my view to some values in my Model so that I can tell which ones are selected. How can I set up a binding to do this?
For a single value (one not in an array), I've been doing this:
Binding binding = new Binding();
binding.getChildren().add(
new Binding(viewObj.getTextBox(),"value",modelObj,"textValue"));
But I don't know how to transition this to work for an array of items. Please help.

I ended up not using Gwittir for those parts which dealt with arrays of data. Instead I manually transferred the data from my view to my controller when the user clicked a button which would record the state of all the checkboxes in an array to an array of values in the controller.

Related

Drools Business Central Workbench - Test Scenario: List subproperty on object

Is there a way to populate a List property on an object being tested under the "new style" test scenario?
I see some "legacy" test cases which seem to achieve this so am wondering if the new style test scenario handles this.
I added the List model to my test case, which enabled me to expand the sub-property on the object, however there is only one field available there, "empty" (boolean). Is there a way to add an object here? If it makes any difference, the model is an external java dependency.
Update
The reason I wasn't able to add the List of objects was because I didn't explicitly import that object dependency into the test. Once you import it you can follow the steps given in the answer below.
It's definitely possible to manage a List property under the Test Scenario Editor.
Please consider the following example: A Book class with a List<String> property named topics.
Creating a new Test Scenario assets, please select the column where you need to add the List property, and in the right part of the editor select the property expanding the Book class, as shown below:
Pressing Insert Data Ojbect button will assign the selected List property to the selected column:
To fill the data in the List property, please double click on the Insert value cell, in the first scenario data row. A popup will appear. Its aim is to fill data inside a collection
To add a value, please press the Add list value link in the bottom part of the popup. Here, you'll be able to fill a single item on the list
Repeat this step for all the items you need to add to the list. When completed, simply press to Save button
The popup will close and you should see the previously selected data cell filled with a label similar to List(2), the number represents the number of the items in the list.

How to count element of one controller into another

i've a question to ask for my mvc project...
i have two controllers: Giurisprudenza e GiurisprudenzaNode, these controllers implement an index with the list of elements and a crud system to add/edit/remove elements. In the Girusiprudenza view page every element has a button that return you into the relative GiurisprudenzaNode page, with the list of elements contained into the primary element.
I would like to insert a label next to every element of the list in Giurisprudenza that say how many elements there are into that single primary element, but i don't know how to do that count... Anybody can help me?
for this you dont need two controllers or two different view .
For this you need to follow below steps.
Create a viewModel (Customize mix of both models)
add custom property in you this viewmodel for counts
create new view for this ViewModel class .
Let me know if you need code snippet for this.
View Model from MSDN

UIPickerView custom title

I have an array that I use to populate my pickerView, a simple string array. The issue is that I need the first item to be something like "Choose team".
The only way I have achieved that is the add the first item in the array to be "Choose team", but this messes up the array structure for me and I wonder if there is another way of doing this.
So, can I add a default value to a UIPickerValue, if no: how would you have solved this issue?
There is no easy way to add a default value. You can duplicate the array and add the string to the duplicated version for display but then you have to be careful about indexing issues. If the array's value changes programmatically, it can be a disaster. This duplication thing is not a good design anyway.
Alternatively, you can add a fixed label on right side of each picker values. Here is the example
Fixed labels in the selection bar of a UIPickerView

wicket: Dropdownchoice

i have two dropdowns using same model and sets the value into it. Dropdown1 will visible on screen always and Dropdown2, will be visible for only one particular option choosen in Dropdown1. and i am making an query to the DB based on the selections in dropdowns.
But when i have both the dropdown first and then hide the second one, The value already set but the Dropdown2 is still avalible in my model, and making my query to fetch improper data.
So can any one suggest me an idea, how to set the value to null for the attribute which is actually set but dropdown2, if dropdown2 is inVisible.
(i tried to set the ModelObject to null, when making the dropdown2 invisible (using AjaxFormComponentupdateBehavior), but when i make the dropdown2, visible again, it returns null,even if i make any selection in it)
Are you using a LoadableDetachableModel ? try to explicitly detach model from that dropdown on setHide event. I did not try it though.

Extjs connect grid to a form

I have a grid in Extjs that has list of information from database, now I want that list be processed through php, how would I make the grid act as a form, and when the list is clicked(multiselect true) the user gets the values of the list buttons, also, how would I disable the form buttons until list is seleted from grid?
Your question doesn't have enough information, so I can only give you some generic pointers.
To process the values from a grid: read the values from the grid's store and call Ext.Ajax.request passing whatever data you want from the grid.
Example:
var values = [];
store.each(function(rec){
values.push({id: rec.get('id'), value: rec.get('value')});
});
Ext.Ajax.request({url: '/my/url.php', jsonData: values});
To disable the form buttons until you click something just pass in the disabled: true to the config. You then listen for the grid's http://docs.sencha.com/ext-js/4-0/#/api/Ext.grid.Panel-event-itemclick and call button.enable when that happens