Thank you for your answer @gorelov , I’m not sure I understand this point though. Could you please elaborate a bit on this please? How would I deal now with a situatino where I have e.g. an AbstractInvoiceEditView and then two views that extend from this abstract view - e.g. OutoingInvoiceEditView and OfferEditView.
This issue has been targeted to 1.4 which is released yesterday but I don’t see this is working!
For Studio issues, assigning Milestone 1.4 when the feature release 1.4.0 is already out means that the issue is targeted to one of 1.4.x patches.
In order to switch to the dark theme variant, you need to set it in the main application class using the @Theme
annotation, e.g.:
@Theme(value = "<theme_name>", variant = Lumo.DARK)
Vaadin doesn’t provide runtime variant switching.
Gleb
Sorry, I didn’t get your question right. A view can extend any base class on your choice, the only limitation is that io.jmix.flowui.view.View
must be in the inheritance hierarchy.
Gleb
Hi Gleb
Thanks. It worked.
@Theme(value = "inteaccpf", variant = Lumo.DARK)
@PWA(name = "Inteaccpf", shortName = "Inteaccpf")
@SpringBootApplication
public class InteaccpfApplication implements AppShellConfigurator {
@Autowired
private Environment environment;
public static void main(String[] args) {
SpringApplication.run(InteaccpfApplication.class, args);
}
Hi Konstantin
Tried and looks good
A couple of questions:
- How can we handle if it is an image (byte[])
- How can we display the file/image on a screen?
The second part of my exchange is:
Hi Konstantin
Thanks for clarifying, we may lose that functionality in Flow to control the cursor. But I hope we’ll not loose many. How can you please help how we use the inline editor in datagrid?
I see in Vaadin grid we can perform it easily as described here and the non-buffered datagrid looks like as follows:
I tried the code-snipped in Vaadin site but it looks like some functions are not recognized in Jmix.
Grid.Column<BankCashEntryLine> descriptionColumn = bankCashEntryLineTable.getColumnByKey("description");
Binder<BankCashEntryLine> binder = new Binder<>(BankCashEntryLine.class);
Editor<BankCashEntryLine> editor = bankCashEntryLineTable.getEditor();
editor.setBinder(binder);
TextField description = new TextField();
description.setWidthFull();
addCloseHandler(description, editor);
binder.forField(description)
.asRequired("Description must not be empty")
.withStatusLabel(firstNameValidationMessage)
.bind(BankCashEntryLine::getDescription, BankCashEntryLine::setDescription);
descriptionColumn.setEditorComponent(description);
bankCashEntryLineTable.addItemDoubleClickListener(e -> {
editor.editItem(e.getItem());
Component editorComponent = e.getColumn().getEditorComponent();
if (editorComponent instanceof Focusable) {
((Focusable<Component>) editorComponent).focus();
}
});
The following lines are not recognized in the code above:
addCloseHandler(description, editor);
editor.editItem(e.getItem());
Component editorComponent = e.getColumn().getEditorComponent();
Can you please help?
By default, in the Vaadin’ doc the code snippets are collapsed and display only a Sample related code, hence if you just copy-paste code, it might not work. To see the full sample code you need to expand it
In the full code snippet, you can find the missing method
Gleb
The Upload SucceededEvent
contains the MIME Type of the file, which can be used to recognize file type.
Is there a “label” component? I cannot find it.
No, instead you can use one of HTML components like span
, p
, div
, headers, e.g.: <span text="Some text content"/>
Gleb
Thank you Gleb. That’s a nice tips seeing the full-code. Honestly, I didn’t notice until you mentioned.
I have tried but still have something missing in Jmix environment and didn’t appear the Edit column added as well as edit mode of the columns.
I have attached a demo project, it will be appreciated if you please help fixing where is the problem. This will be a very useful in many projects and Views for many developers for sure. BTW, any plan to simplify?
To use, go to CustomerContact Details view and create contact lines and try to edit the lines.
jmixDatagridFlowDemo.zip (232.9 KB)
Thanks for reply!
Regarding layouts, are hbox and vbox enough?
I am missing a data grid to keep several span and textfield aligned
In this case span is not aligned to textfield no matter what I do:
<hbox >
<vbox>
<span text="ciao" />
<span text="ciaociao" />
<span text="ciaociao" />
</vbox>
<vbox>
<textField id="nomeField" property="nome"/>
<textField id="nomeField2" property="nome"/>
<textField id="nomeField3" property="nome"/>
</vbox>
<vbox>
<textField id="nomeField6" property="nome"/>
<textField id="nomeField4" property="nome"/>
<textField id="nomeField5" property="nome"/>
</vbox>
</hbox>
And I need also to update span content via java code (with label it was possible)
ValidationMessage
is a class created for Vaadin sample, see additional tabs with code (some samples have more than one class attached)
In order to add components programmatically you need to obtain a view content object, e.g.:
getContent().add(grid, firstNameValidationMessage, lastNameValidationMessage, emailValidationMessage);
As for Grid Editor
, it works only with Vaadin Binder
, but we use our own data binding that aware of CollectionContainer
s. It means that if you need Grid Editor
then you have to use Vaadin data binding.
Could you please describe your task in more detail? It seems that you’re trying to create a form (in this case the FormLayout
component is the best solution), but I can be mistaken.
Hello,
We have planned this for the end of November.
It is a sort of form but the description of the fields is dynamic because it depends by another field.
A simple example: each textfield in a row contains a number. On the left I have a span that can change to “kg” “g” “mg” (the unit of scale).