Vaadin: spacing with vertical scrollbar - scrollbar

Environment:
Vaadin 7.6.2
no custom CSS rules so far besides for the headline
Default theme in place: 'valo'.
In a nutshell
I have trouble with spacing while showing vertical scroll bars.
Let me show some pictures to demonstrate the problem:
Correct on the left, incorrect on the right.
Description
When no scroll bars are shown, the spacing (padding) is shown correctly on the left as well as on the right side horizontally (refer to the red boxes).
But as soon as the scroll bar gets visible, the spacing on the right between the Combobox and the scrollbar seems to be gone (refer to the red strokes on the left in each picture as measurement line).
However, if I add a margin (right) on the GridLayout containing the Combobox, the margin stays and behaves as expected when the scroll bars appears.
Details
The setup of the single components involved is as follows:
--- Panel rightSection -------------------------
| |
| --- VerticalLayout componentContainer ------ |
| | | |
| | --- CustomComponent componentWrapper --- | |
| | | | | |
| | | --- GridLayout grid ---------------- | | |
| | | | | | | |
| | | | --- Label headline ------------- | | | |
| | | | | | | | | |
| | | | -------------------------------- | | | |
| | | | | | | |
| | | | --- ComboBox combobox ---------- | | | |
| | | | | | | | | |
| | | | -------------------------------- | | | |
| | | | | | | |
The crucial settings are as following:
rightSection.setSizeFull(); // Panel
componentContainer.setSizeFull(); // VerticalLayout
// the CustomComponent for being able to show the vertical scrollbars
// as there is another component at the bottom of the
// componentContainer which has to be
// excluded of the vertical scrollbars
// therefore, in the constructor
CustomComponent(Component content) {
addStyleName("v-scrollable");
setCompositionRoot(content);
setHeight(100, Unit.PERCENTAGE);
setWidth(100, Unit.PERCENTAGE);
content.setSizeUndefined();
content.setWidth(100, Unit.PERCENTAGE);
}
// make the customComponent take full space inside its parent
componentContainer.setExpandRatio(componentWrapper, 1);
headline.setWidth(100, Unit.PERCENTAGE);
combobox.setWidth(100, Unit.PERCENTAGE);
Finally
How to preserve the space between the components inside the GridLayout and the vertical scrollbars (if present)?
As any time, any hint is appreciated :)
Cheers,
bully

Related

Centos7.8 install openstack mitaka version, control the node to install mirror service glance, the mirror contains problems

Centos7.8 install openstack mitaka version, control the node to install mirror service glance, the mirror contains problems
According to the official documentation Mitaka official documentation operations, Step 3 Upload the image to the image service using the QCOW2 disk format, bare container format, and public visibility so all projects can access it:
I execute the following command
openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
The size of the image in the output is zero. How should I check this problem
[root#controller ~]# openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
+------------------+------------------------------------------------------+
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | d41d8cd98f00b204e9800998ecf8427e |
| container_format | bare |
| created_at | 2020-05-24T14:45:54Z |
| disk_format | qcow2 |
| file | /v2/images/c89f6866-0c48-4ee5-84f1-bf7fa0998edf/file |
| id | c89f6866-0c48-4ee5-84f1-bf7fa0998edf |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | a9629b19eb9348adbf02a5432dd79411 |
| protected | False |
| schema | /v2/schemas/image |
| size | 0 |
| status | active |
| tags | |
| updated_at | 2020-05-24T14:45:54Z |
| virtual_size | None |
| visibility | public |
+------------------+------------------------------------------------------+

Firebase how to index this data to be fetched?

I have a DB with users and items.
Every user has languages, which is an array of languages, for example ['en', 'ar']
Every item has language, which is a string, for example 'en'.
How can I index my items, such that I can get a list of the last X items in an array of languages? (i.e - latest 5 items who are either 'en' or 'ar')
For a single language the solution is simple - have an index that has the language key, and array of item keys ordered by whatever.
Please note that the Firebase official documentation recommends against using arrays. IMHO, the main problem in your project is that you trying to use an array, which is an anti-pattern when it comes to Firebase. Beside that, one of the many reasons Firebase recommends against using arrays is that it makes the security rules impossible to write. Because a Firebase database is structured as pairs of key and values, the best option is to use a Map.
To achieve what you want, i recomand you using a database structure which looks like this:
Firebase-root
|
--- users
| |
| --- UID1
| | |
| | --- languages
| | |
| | --- languageId1: true
| | |
| | --- languageId2: true
| |
| --- UID2
| |
| --- languages
| |
| --- languageId3: true
| |
| --- languageId4: true
|
--- languages
| |
| --- languageId1
| | |
| | --- languageName: "en"
| | |
| | --- items
| | |
| | --- itemId1: true
| |
| --- languageId2: "ar"
| | |
| | --- languageName: "ar"
| | |
| | --- items
| | |
| | --- itemId2: true
|
--- item
|
--- itemId1
| |
| --- title: "ItemTitleEn"
| |
| --- en: true
|
--- itemId2
|
--- title: "ItemTitleAr"
|
--- ar: true
Now, with this database structure you can achieve everything you want. For example, you can query your database to display all languages from you database. You can also display all the languages of a single user.
If you want to query your database for the last x item which have the language set to en, you just need to put a listener on the items node and create a query using functions like: orderByChild(), equalsTo() and limitToLast(). Such a query should look like this:
query = rootRef.child("items")
.orderByChild("en")
.equalsTo(true)
.limitToLast(5)
.addListener(/* ... */)
EDIT: Unfortunately Firebase does not allow multiple conditions in a query. So in Firebase there is no where clause that sounds like this: WHERE language = "en" AND language = "ar". So to solve this, you need to put a listener on the other node, on languages node.
The flow is as follows:
yourRef = rootRef.child("languages"); //only one listener
yourRef.addListener(
1. Create a list
2. get items from dataSnapshot.child("languageId1").child("items").getChildren()
3. add **en** items to the list
4. get items from dataSnapshot.child("languageId2").child("items").getChildren()
5. add **ar** items to the list
6. display the list that contains data from both languages
)
Hope it helps.

Nested blocks on sonata show action

I would like to build a show view like this, with sonata :
+---------------------------------------------------+
| PAGE |
| |
| +---------------------------+ +-----------+ |
| | BLOCK 1 | | BLOCK 2 | |
| | +--------+ +-------+ | | | |
| | | 1.1 | | 1.2 | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | +--------+ +-------+ | | | |
| +---------------------------+ +-----------+ |
| |
+---------------------------------------------------+
I know you can build BLOCK 1 and BLOCK 2 with the "with()" method, but I don't see any way to nest BLOCK 1.1 and 1.2 inside BLOCK 1. I don't want to use tabs, I want everything on the same page.
Any way to nest more than 1 level of blocks ?
Ok. You have show action. And you you use, let's say two blocks (I mean ->with() ).
Also you have in both of blocks different fields. You can overwrite the template of one of the fields and whatever you want inside that template. You can event create blocks (with sonata styles), which will look like thous, which are made by sonata ->with().
In sonata admin:
->with('Block1')
->add('your_field', null, [
'required' => false,
'template' => 'AppBundle::Admin\path_to_your_template\show_some_field.html.twig',
])
->end()
And your template:
{% extends 'SonataAdminBundle:CRUD:base_show_field.html.twig' %}
{% block field %}
{# Make here whatever you want #}
{{ object.your_field }}
{% endblock field%}
I can propose a sample if you will need it.

docker - multiple projects on one Dockerfile and docker-compose.yml

I'm starting with Docker and in my opinion is great! Now I'm looking solution for this organization:
Now I have this structure:
Applications
| +--app1
| | +--node_modules
| | +--package.json
| | +--...
| +--app2
| | +--node_modules
| | +--package.json
| | +--...
| ....
| docker-compose.app1.yml
| docker-compose.app2.yml
| ....
| Dockerfile //my personalized image for all projects
But I want reach this:
Applications
| +--app1
| | +--node_modules //empty in host
| | +--package.json
| | +--docker-compose.app1.yml //override compose
| | +--...
| +--app2
| | +--node_modules //empty in host
| | +--package.json
| | +--...
| ....
| +--node_modules //global node_modules folder (linked to projects)
| docker-compose.yml //principal compose
| Dockerfile //my personalized image for all projects
I thinking too about create one global "server" and link all projects on VHosts but how I'll get access to each of project?
You are looking for docker-comopose extends. Thas permits you override previus configurations.
web:
extends: file: common-services.yml
service: webapp
See full documentation in : https://docs.docker.com/compose/extends/#extending-services

tmux bind shortcut to create a pane above or to the left?

Whenever I use tmux split-window -h/v, it creates the new split to the right/bottom, respectively. I want a command that creates the new split on the other side (i.e., to the left/top), but I can't find any simple answer for this anywhere... How can I bind this behavior into a shortcut?
What happens by default:
_______ _______
| | | | |
| * | == split-window -h => | | * |
| | | | |
------- -------
What I want a shortcut for:
_______ _______
| | | | |
| * | == ? => | * | |
| | | | |
------- -------
As from version 2.0, tmux's split-window and join-window understand -b to create the pane to the left or above the target pane.
Split horizontally and place at the left:
tmux split-window -hb
Split vertically and place at the top:
tmux split-window -vb
Update:
From inside tmux you can use } for swapping the panels once you have split the window:
Example for vertical splitting:
Ctrl + B + %
Ctrl + B + }
As above, but remember, tmux has a problem if you run it from PuTTY or from virtual machine. It works properly, but there's sometimes a problem with create, switching and resize panes due to lack of keys recognition.

Resources