How to access components (like a TextField) defined in one screen or controller from another screen or controller. For example, I wanna get a id of “” from one screen or controller and define the id in another screen or controller.
Please explain what you are going to achieve. Are these views related somehow? Do you open one from another?
Cause I want to set a condition in “dialog.java” by getting the id from “editor.xml”. I create a button in “editor.xml” and after clicking the button it will show the dialog which made of “dialog.java” and “dialog.xml”. But there is a " textField id=“newodometerField” property=“odometer” label=“New Odometer, km” " in “dialog.java” which user have to enter a larger value than " textField id=“lastodometerField” label=“Last Odometer, km” readOnly=“true” " in “editor.xml”. That’s why I have to set a condition which is get the id from “editor.xml” and define it in the "dialog.java’. Reminder: I’m using Jmix 2.0 in this project.
As far as I understand, you need to pass a value from the EditorView to the DialogView opened by clicking a button. You can do it by creating a setter in the DialogView class and invoking it after creating the view:
@Autowired
private DialogWindows dialogWindows;
private void openViewWithParams(Double lastOdometerValue) {
DialogWindow<DialogView> window =
dialogWindows.view(this, DialogView.class).build();
window.getView().setLastOdometerValue(lastOdometerValue);
window.open();
}
See Opening Dialog Windows for details.