Vaadin 12 ItemLabelGenerator of ComboBox when used in grid ComponentRenderer - vaadin

Today I have upgraded from Vaadin 11.0.2 to 12.0.0 - Everything went smooth, except one thing:
In a grid of mine where I have a rendered column to show a ComboBox, there is a strange issue with the ItemLabelGenerator. I defined it as follows:
grid.addColumn(new ComponentRenderer<>(gridItem -> {
ComboBox<MyObject> comboBox = new ComboBox<>();
comboBox.setItems(myObjectsService.findAll());
comboBox.setValue(gridItem.getMyObject());
comboBox.setItemLabelGenerator(MyObject::getName); // MyObject::getName returns String
// comboBox.addValueChangeListener omitted
return comboBox;
}))
.setHeader("MyObject")
.setId("myObject");
This has been working fine in Vaadin 11.0.2 but now the item-labels are displayed as package.path.to.myobject.MyObject#41d8d522 and not the actual name of gridItem.getMyObject();
When I click on the ComboBox to show all options, the labels are correct! but as soon as I select one, it turns into the aforementioned wrong string.
Important detail: for testing reasons I have now added a similar ComboBox with the same setup into a simple VerticalLayout (AKA not in a grid), and there everything works perfectly fine. That is why I think the issue is with the ComponentRenderer somehow and not with the ComboBox alone.
Is this a bug, or have I missed something when upgrading to 12.0.0 ?
In the vaadin blog post about the new release of Vaadin 12, I see that there is one known breaking change, and it has to do with ComboBox:
If you are coming from Vaadin 10 or 11, you should update the platform dependency in your project build file. The only breaking change we introduced was because ComboBox now supports server-side lazy-loading. If you are using filtering with a ComboBox see instructions on fixing the possible compilation issue.
However, no filtering whatsoever is involved in my case.

This answer was written by Diego Sanz Villafruela in the Vaadin Forum, where I raised this exact issue too.
I created an example similar to yours and I discover that the order in
which you set the value and the ItemLabelGenerator matters.
You should put comboBox.setValue after setting the
comboBox.setItemLabelGenerator.
Otherwise the method String.valueOf(obj) will be called the first
time, giving you the object's representation (MyObject#41d8d522) and
not the name.

Related

Strange behavior of iOS datepicker in react-native 0.63.3

I use date pickers in my app and till the update of RN to 0.63 they were working fine. Date picking in the 'date' mode was done on iOS by means of selecting values on 3 vertically spinning "drums" : the date, the month and the year. Now after the update it looks like this :
This is what a user sees instead of the "drums". The area is not spinnable nor swipable and only responds to a click on the highlighted date.
This is what a user sees after a click to the highlighted date
It kind of works but offers an extremely convoluted UX. I wonder if this is a "new norm" or is there is a way to configure/hack an underlying native component in order to revert to previous behavior. The exact component I am using is xgfe/react-native-datepicker. I also tried to switch to a newer #react-native-community/datetimepicker, but the result is roughly the same with this strange intermediate control opening first and if clicked - opening a calendar modal.
I just figured out the #react-native-community/datetimepicker exposes a "display" property for IOS (possible values: 'default', 'compact', 'spinner', 'inline') which determines which exact UI driver to use. The 'spinner' renders the mentioned 'drums' that every IOS user is accustomed to, the 'inline' renders a calendar. I assume that 'default' can differ, but in my case it yielded the same result as 'compact' which is what you can see above. Apparently in the older RN components which do not expose such property the default driver will be used possibly resulting in all sorts of inconveniencies.

Zkoss listbox+frozen+hide_column

I use listbox with one frozen column. it's working fine but if i hide last (only last) column , i'll get problem with listbox's content. Header scrolls normaly but all rows of listbox appear.
ZK-8.5.2.1-Eval
I use olde frozen - listbox.setAttribute("org.zkoss.zul.frozen.smooth", false);
I'd suggest to try the latest version ZK 8.6.0.1 first? The release notes (8.6.0 / 8.6.0.1) indicate errors being fixed regarding frozen and listheaders maybe the problem doesn't happen anymore with the latest version.
It the problem still exists it would help if you can provide a reproducing/runnable example e.g. on zkfiddle.org Please, save and post the link or url-path here.

FastReport4: Refresh Dataset

My Report.ShowPreparedReport didn't recognize a new addition to my frxDBDataset.
So, I was building 1 report using TfrxDBDataset linked to a TVirtualTable.
Previously only 10 fields stated in Report1.fr3 and it works well.
I do the SaveAs from Report1.fr3 to Report2.fr3 in designer mode
Get back to my Delphi and add 1 new field "tec" in my TVirtualTable
Go back again in ReportDesigner (file Report2.fr3) and see that my new "tec" field is listed in Data tree.
Add the "tec" field to the report.
Preview while on designer and it was normal.
Run the program and call to preview report, it says "field 'tec' cannot be found" or something like that.
Anyone got solution?
Thanks
Please Try.
TVirtualTable.Refresh;
frxDBDataset.FieldAliases.Clear;
When you clear aliases then call Designer
FastReport automatically updates aliases.
That was the perfect solution for me.

Android - What does question mark signify in searchable.xml?

I'm debugging SearchableDictionary sample on android 4.0. In searchable.xml, what does question mark signify in this attribute, android:searchSuggestSelection=" ?"?
Here is the snippet :
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="#string/search_label"
android:hint="#string/search_hint"
android:searchSettingsDescription="#string/settings_description"
android:searchSuggestAuthority="com.example.android.searchabledict.DictionaryProvider"
android:searchSuggestIntentAction="android.intent.action.VIEW"
android:searchSuggestIntentData="content://com.example.android.searchabledict.DictionaryProvider/dictionary"
android:searchSuggestSelection=" ?"
android:searchSuggestThreshold="1"
android:includeInGlobalSearch="true"
>
Thanks.
It stands for the query typed by the user. See the docs
android:searchSuggestSelection [String]
This value is passed into your
query function as the selection parameter. Typically this is a WHERE
clause for your database, and should contain a single question mark,
which is a placeholder for the actual query string that has been typed
by the user (for example, "query=?").
Alternate
android:searchSuggestSelection="word MATCH ?"
also had a problem on this one, SearchableDictionary sample. cannot find the Resource folder because R.java is not generated which is probably the same problem you were experiencing that's why your debugging the XMLs. this is the solution that worked for me. link
Right-click on your project
Choose Properties
Choose Android in the left menu
Tick a box next to the appropriate Project Build Target.*****
Click Apply and OK
My additional instructions:
*****Choose build higher than API 10 or starting from API 11. If you choose lower than 11 you will still get the error. This worked for me. tried most of the suggestions ahead of this. finally solved it.

Intraweb question about improperly working (radiobutton)?

HI,
I created 4 radiobuttons in a intraweb application.
One is checked by default, the rest is not.
The belong to the same group called group. (I set the group properly of each TIWradiobutton)
There is twiimage image which has click event. In that click event, I tried to set the radiobuttons.
E.g.
radiobutton1.checked:=true;
The problem is that this sometimes set the radiobutton and sometimes it does not.
I found a fix by setting the rest of radiobuttons.checked to false. That fixed the problem.
I wonder what I did wrong in the first place when I just used one assignment.
Can you tell me if it is a bug in intraweb or I used radiobutton improperly?
Thanks.
just create a IWRadioGroup1(in iwstanderd pallet ) in your form
select IWRadioGroup1 , in the properties panenel dblclick on items
you will get a stringlist editor ,type the captions of your four radiobuttons line by line then click OK
now select your IWImage1 ,goto click events just type th above code
procedure TformMain.IWImage1Click(Sender: TObject);
begin
IWRadioGroup1.ItemIndex := 2 // 2 is the radiobutton number as you typed in stringlist editor
end;
sometimes IW or components build over the IW (e.g TMS suite for IW) have a strange behavior.you can find how it works by looking out in the code, how they manage the java script behind your radio groups.
Also sometimes you must manage the components exactly how Atozed say in their documentation.
Probably isn't the best answer, but if you'll work a lot with IW you'll see that it has a lots of limitations and strange behavior (only if you don't work in their style, which sometimes differs a lot from win32 style).
best regards,

Resources