Vaadin Dialog resize programmatically - vaadin

Vaadin 14.2.0.alpha7 added new functionality to Dialog component (https://vaadin.com/api/platform/14.2.0.alpha7/com/vaadin/flow/component/dialog/Dialog.html), especially the resizing availability. Unfortunately I was unable to find a way to have dialog being created with width I need neither to set the width programmatically after the dialog is opened.
Here are few lines of code I use for described purposes (unsuccessfully):
dialog.isResizable = true
dialog.width = "900px"
dialog.addOpenedChangeListener { event ->
println("!!!opened-changed event fired")
dialog.width = "900px"
println("!!!dialog width = ${dialog.width}")
}
dialog.addResizeListener { event ->
println("!!! on resize event width = ${dialog.width}")
}
When I open the dialog it appears with its limited width (around 500px), the OpenedChanged event being fired and prints that dialog has 900px width (while its not!), when I resize it manually the Resize event being fired and prints that dialog has around 600px width (after I increased it a bit manually using mouse).
I know that early versions of Dialog had limited width (around 500px) in templates and there is workaround with importing styles to adjust dialog width. I was hoping with new version to increase dialog width without touching templates and client-side.
Is there any way to set dialog width and adjust on being opened programmatically without touching client-side templates?
P.S. The 14.2.0 version announced to be published on April so I believe the question is suitable even for now its prerelease version.

This happens due to the max-width setting of ~560px to comply with the materials design. There is a ticket about it here: Dialog Size - Material Theme. (In the default Lumo theme this works out of the box. You can verify it by commenting out #Theme(value = Material::class, variant = Material.LIGHT) in MainLayout.kt)
Unfortunately, as style targets the overlay part, the only one way to overcome this is using style files. On the other hand, it should be pretty straightforward in the current version :)
I created a pull request to your repo with the changes needed. Feel free to use it, if you want Make width acccept values more than 500px :)

Related

iOS Swift: maximumContentSizeCategory not working on UILabel

According to this article:
https://useyourloaf.com/blog/restricting-dynamic-type-sizes/
And this WWDC 2021 video:
https://developer.apple.com/videos/play/wwdc2021/10059/?time=879
The minimumContentSizeCategory and maximumContentSizeCategory can limit the min and max font size when user uplevel/downlevel the font sizes in System Accessibility settings.
However I tried it out, and from the debugging info these two settings are properly set, but in view rendering, the font size still goes to very large if accessibility font size is very large.
// before setting
print(label.appliedContentSizeCategoryLimitsDescription)
label.minimumContentSizeCategory = .small
label.maximumContentSizeCategory = .accessibilityMedium
// after setting
print(label.appliedContentSizeCategoryLimitsDescription)
print results:
UILabel:0x7fd610a414a0: AX-L
--> AX-L
UILabel:0x7fd610a414a0: S <= (none->)AX-M <= AX-M
--> AX-M
How can I properly use these two settings?
Any ideas on how to properly use these two settings?
I hope that's the proper way because I use them as you did (and it works).
I created a blank project in Interface Builder (Xcode 13.4.1) as follows:
... and the Dynamic Type feature is blocked within the specified thresholds I defined like you (in the viewDidLoad of the view controller).
I think you should check out the way you created your label because, with the above one, it works like a charm.

How to add a scrollbar on a listbox

In Vaadin 14, I would like to have a listbox with a scrollbar. Either permanently present, or even better, one that appears when the space needed for the list exceeds the maximum height of the listbox.
It does not necessarily have to be done using the vaadin core component; if there is something else out there that would do the same job and can be integrated into my Vaadin application easily, that's also fine.
I have little experience in web components and have no idea where to start to achieve this.
If much more knowledge is necessary, please point me in the right direction to learn it.
This is how a ListBox component already works in Vaadin :) Scrollbar appears, if there is no enough space to display all items
ListBox<String> listBox = new ListBox<>();
listBox.setItems("Bread", "Butter", "Milk");
listBox.setHeight("100px");
add(listBox);
A Web-component Vaadin docs page Vaadin-ListBox HTML
Setting height will work, and with minor CSS changes max-height will also work. Here’s what you need to add to your theme.
In Java (Vaadin 14+):
#CssImport(value = "./styles/my-styles.css", themeFor = "vaadin-list-box")
In CSS (my-styles.css):
[part="items"] {
flex: auto;
height: auto;
}
I opened a new issue for fixing this: https://github.com/vaadin/vaadin-list-box/issues/56

Swift - Strange text rendering at runtime

I am working on an iOS app right now. I usually use the Interface Builder and recently it has been producing an issue. When the storyboard is seen in Xcode the labels on everything look fine, but some UI elements don't render properly at runtime. This has also happened for some of the images in this project. The only font used is the system font.
I have tried readjusting the font and using attributed text, but this hasn't worked for the specific label shown. Just to mention, this app is a shared project through Git so it may be an issue with it pulling incorrectly or something, but that seems odd for it to affect the text after it has been changed and adjusted.
View post on imgur.com
The results should be crystal clear text on iOS, but it results in "fuzzy" text you would expect if you were running the Windows XP on a 480p screen. What could be causing this issue?
It seems like the layer of a superview of the UILabel in the provided image is set to pre-render. This is good for performance reasons but may not always look as good, as is seen here.
If you're setting a custom layer on a superview of the UILabel, try setting the layer's shouldRasterize to false.
Ex: exampleLayer.shouldRasterize = false

How to handle a change in system level font size on iOS with React Native?

We have a situation where if a user decides to increase the "Larger Text" size in iOS Settings (see image below), it then messes up our view layouts in React Native, as the font size will now be larger.
For example here is a ListView row BEFORE changing the "Larger Text" setting in iOS system settings:
And here is the same row AFTER increasing the "Larger Text" setting:
What is best practice to handle such font scale increase in React Native ? This is obviously just one example, and there are other scenario's such as a View that only contains Text, but we do not want to increase the height of that View at runtime.
Appreciate anyone's advice on this, thanks!
You can do the following to block such changes (do it on your root js file):
Text.defaultProps.allowFontScaling = false;
you could use ITEM_SIZE * PixelRatio.getFontScale()

Highcharts exporting error?

I've just upgraded my site to the new 3.0 release.
The charts shown on my site are 990x548 pixels.
But when I select an export, regardless of whether it's png/jpg/pdf/svg, the output is 1020x930pixels.
Is this a known bug, or might I be doing something wrong?
Thanks!
Yo can define width / height exported image by chartOptions parameter.
http://api.highcharts.com/highcharts#exporting.chartOptions
the exportButton and printButton are now removed, and replaced with a generic contextButton. So you can use that one for your dropdown menu: http://api.highcharts.com/highcharts#exporting.buttons.
See also the new article at http://docs.highcharts.com/#export-module
Please refer my question
Highcharts 3.0 version changes in exporting options?
The problem was that I didn't have an explicit width set on the chartContainer div. I was just letting it flow to 100% of the parent element. As soon as I set an explicit width on that div, the exporting size options worked. Before that the chart would come out squished regardless of what documented options I set.

Resources