Vaadin Grid wrap labels in componentColumns - vaadin

I'm currently working on a webapp project in Vaadin 10. On the main page there's an overview of your current chats. Each chat is displayed as a bubble looking like:
It contains an image and a label.
I placed the bubbles in a Grid to ensure fast loading and flexibility like this:
`Grid<VisualGroup> cloudGrid = new Grid<VisualGroup>();
cloudGrid.setWidth("100%");
cloudGrid.setHeight("100%");
cloudGrid.getElement().getStyle().set("border","white");
cloudGrid.addComponentColumn(VisualGroupComponent::new);
cloudGrid.setItems(groups);`
My problem is that the label does not wrap when I put the components in the grid. If I create the component independently the text wraps correctly like:
But if I use the grid like described above it looks:
Does anyone know how to get text wrapping working in ComponentColumns in Vaadin?
If anyone knows the exact attribute I need to overwrite to get just the wrapping working and not delete every thing else that would probably the best solution. But for now that is a workaround.

Related

iOS How to get size of chart grid?

I have used Charts library to make my chart. It really has ton of options, but I have been struggling to implement background for grid. I want to have gradient background, but just for grid part. I have done this by putting my view behind the chart view. I have printed _viewPortHandler.contentRect, and from there i positioned my view. Now, while this works, it is not most ideal solution. I would like to somehow at runtime have option to get gridview size, but since _viewPortHandler is internal, I see no option to do this:
Is there any better way to do this?

Get items visible in viewport of Grid in Vaadin 8 & 10

The Grid widget in Vaadin 8 & 10 offers a method to get a Set of the currently selected items: Grid::getSelectedItems.
In a similar vein, I would like to get a collection of the items that are currently visible to the user in the Grid. Say my Grid widget holds 10 items, but only 5 are viewable because the Grid widget is too short to display them all. I want to know which of the five can be seen by the user.
This is not trivial task, I have something similar, but not exactly this case before. First of all, I would I would create custom Layout component, e.g. by extending CssLayout in similar fashion as has been discussed here ( How to make UI receive scroll events ) in addition to reporting scroll events I would report the position of the layout on the viewport (see http://www.gwtproject.org/javadoc/latest/com/google/gwt/dom/client/Element.html ). Yes GWT and client side development is required.
I would use this layout as wrapper for the Grid, i.e. Grid would be in the layout. You could extend the Grid component as well. But I think doing the layout wrapper gives you nice tool that you can use with other components as well for which you need to determine, whether they are actually visible or not.
This way I can then calculate which portion of the layout is in the viewport. As you see, there are number of cases here, e.g. only bottom of the Grid or top of the Grid is visible. Then I need to know row-height, header height, etc. That enables me to calculate how many rows there are visible. I hope you get the idea. The outcome for the generic case will be rather lengthy piece of code when all possibilities are enumerated. This calculation you can do on server side.

Responsiveness of Vaadin FormLayout

I am starting to make my Vaadin web app responsive. Reading Vaadin docs, I managed to make a CssLayout flexible such that an image is shown either to the left of a text section or in a separate row depending on available width.
Now I want to make my login form flexible. By default, captions are moved to the left of the fields. How can I achieve that the captions are moved to the top of the fields when a certain width is reached? Is that even possible with FormLayout?
Can't really imagine that it is possible with CSS because the FormLayout is rendered as HTML table. If so, what is a simple alternative?
That is not possible with FormLayout. Structure of FormLayout is not flexible. Also there is not simple alternative for that. You can use CssLayout or create your own component container.
Starting point for this can be extending AbstractComponentContainer as described in Creating a simple component container

Icon in header row for column setup

I would like to add an icon to the header of my data grid as it is done in Thunderbird.
There is an icon that is above the vertical scrollbar, no matter the position of the horizontal scrollbar. This icon allows the setup of the columns.
In Delphi there a lot of different grid components, that allow customizations and adding icons to there cells / header cells. But I could not find any component that has an area above the vertical scrollbar that is fixed, which when clicked allows some action. I could even use the VirtualTreeView component to emulate the grid, if it turns out to be easier to customize that component.
I am looking for some guidance on what need to be done to get that functionality.
Thanks,
Thomas
VirtualTreeView in Listbox mode would be nice, because of it's speed, great documentation and ease use in MVC-like patterns. Delphi tempts to store data in the visual components themselves, which letter causes troubles. While VTW allwos the same, it also allows to acutally separate data from GUI, and i like it.
But i am surprised by your claim "which when clicked allows some action.".
Even most basic components allow it:
http://docwiki.embarcadero.com/Libraries/XE2/en/Vcl.Grids.TCustomGrid.OnFixedCellClick
So could you make more detaiils, why you cannot use standard components ? with screenshot and editors, how u want it rendered, where you want to click and what kind of action should happen ?

Adding multipage printing to Windows 8 ListView App

I have an app with a ListView showing a list of summary items.
I've added print support, but I'm stuck on splitting my content into different pages.
I can add multiple pages, but I don't know how to split my content into pages based on page size.
Currently I have a xaml user control for my print content with a bound ItemsControl in it. I'd either like to bind to a list of just the items that will fit on the page, or move the top visible item position up based on the page number.
I'm not sure which is the best approach and I'm not sure how to do either.
The only paging example I could find in the docs was for a rich text block, which relies on the RichTextBlockOverflow control. I don't think that will help me.

Resources