Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source screen to the close events of InputDialog #3135

Open
Flaurite opened this issue Jan 11, 2021 · 0 comments
Open

Add source screen to the close events of InputDialog #3135

Flaurite opened this issue Jan 11, 2021 · 0 comments
Assignees
Labels
type: enhancement New feature or request
Milestone

Comments

@Flaurite
Copy link
Contributor

Environment

  • Platform version: 7.2
  • Client type: Web

Description of the bug or enhancement

Sometimes, after closing InputDilaog, we need to get more specific values, for instance, FileUploadFIeld, which contains fileId.
If FileUploadFIeld is used, so InputDialogCloseEvent will return only FileDescriptor as value and from this fluent code we cannot get FileUploadField:

dialogs.createInputDialog(this)
        .withCaption("InputDialog")
        .withParameters(InputParameter.fileParameter("inputFile"))
        .withCloseListener((InputDialog.InputDialogCloseEvent closeEvent) -> {
            FileDescriptor fileDescriptor = closeEvent.getValue("inputFile");
        })
        .show();

We have to add close listener after InputDialog is built:

        InputDialog inputDialog = dialogs.createInputDialog(this)
                .withCaption("Тест загрузки файла")
                .withParameters(InputParameter.fileParameter("inputFile"))
                .show();

        inputDialog.addAfterCloseListener(afterCloseEvent -> {
            FileUploadField field = (FileUploadField) inputDialog.getWindow().getComponentNN("inputFile");
            UUID fileId = field.getFileId();
        });

Proposal solution

Add to the close event getScreen() or getInputDialog() method:

dialogs.createInputDialog(this)
        .withCaption("InputDialog")
        .withParameters(InputParameter.fileParameter("inputFile"))
        .withCloseListener((InputDialog.InputDialogCloseEvent closeEvent) -> {
            InputDialog inputDialog = closeEvent.getInputDialog();
            FileUploadField field = (FileUploadField) inputDialog.getWindow().getComponentNN("inputFile");
            UUID fileId = field.getFileId();
        })
        .show();
@Flaurite Flaurite added the type: enhancement New feature or request label Jan 11, 2021
@Flaurite Flaurite added this to the Release 7.2 milestone Jan 11, 2021
@glebfox glebfox assigned Flaurite and t1-cuba and unassigned t1-cuba and Flaurite Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants