Source:
public void edit(final UploadImageModel model) { driver.edit(model); model.setImageFileUploadElement(imageFileUpload.getElement()); imageFileUpload.addChangeHandler(changeEvent -> model.getImagePath().setEntity(imageFileUpload.getFilename())); model.getPropertyChangedEvent().addListener((ev, sender, args) -> { if ("Message".equals(args.propertyName)) { setPanelMessage(uploadMessagePanel, model.getMessage()); } else if ("IsValid".equals(args.propertyName)) { uploadMessagePanel.clear(); if (!model.getIsValid() && !model.getInvalidityReasons().isEmpty()) { setPanelMessage(uploadMessagePanel, model.getInvalidityReasons().get(0)); } } }); handleImageUploadBrowserSupport(model); imageSourcePanel.addRadioButton( constants.uploadImageSourceLocal(), model.getImageSourceLocalEnabled().getEntity(), true, event -> { model.getImageSourceLocalEnabled().setEntity(true); setSourceVisibility(model); }); imageSourcePanel.addRadioButton( constants.uploadImageSourceRemote(), !model.getImageSourceLocalEnabled().getEntity(), true, event -> { model.getImageSourceLocalEnabled().setEntity(false); setSourceVisibility(model); }); setSourceVisibility(model); vmDiskPopupWidget.edit(model.getDiskModel()); if (model.getIsResumeUpload()) { diskOptionsLabel.setText(constants.uploadImageDiskOptionsInfoOnlyLabel()); } imageInfoForm.initialize(model.getImageInfoModel()); model.getImageInfoModel().getEntityChangedEvent().addListener((ev, sender, args) -> model.setIsValid(model.getImageInfoModel().getIsValid())); model.getImageInfoModel().initialize(model.getImageFileUploadElement()); imageFileUploadButton.addClickHandler(event -> imageFileUpload.getElement().<InputElement>cast().click()); imageFileUpload.addChangeHandler(event -> imageFileUploadLabel.setText( imageFileUpload.getFilename().replace( "C:\\fakepath\\", ""))); }

Target:
public void edit(final UploadImageModel model) { driver.edit(model); model.setImageFileUploadElement(imageFileUpload.getElement()); imageFileUpload.addChangeHandler(changeEvent -> model.getImagePath().setEntity(imageFileUpload.getFilename())); model.getPropertyChangedEvent().addListener((ev, sender, args) -> { if ("Message".equals(args.propertyName)) { setPanelMessage(uploadMessagePanel, model.getMessage()); } else if ("IsValid".equals(args.propertyName)) { uploadMessagePanel.clear(); if (!model.getIsValid() && !model.getInvalidityReasons().isEmpty()) { setPanelMessage(uploadMessagePanel, model.getInvalidityReasons().get(0)); } } }); handleImageUploadBrowserSupport(model); imageSourcePanel.addRadioButton( constants.uploadImageSourceLocal(), model.getImageSourceLocalEnabled().getEntity(), true, event -> { model.getImageSourceLocalEnabled().setEntity(true); setSourceVisibility(model); }); imageSourcePanel.addRadioButton( constants.uploadImageSourceRemote(), !model.getImageSourceLocalEnabled().getEntity(), true, event -> { model.getImageSourceLocalEnabled().setEntity(false); setSourceVisibility(model); }); setSourceVisibility(model); vmDiskPopupWidget.edit(model.getDiskModel()); if (model.getIsResumeUpload()) { diskOptionsLabel.setText(constants.uploadImageDiskOptionsInfoOnlyLabel()); } imageInfoForm.initialize(model.getImageInfoModel()); model.getImageInfoModel().getEntityChangedEvent().addListener((ev, sender, args) -> model.setIsValid(model.getImageInfoModel().getIsValid())); model.getImageInfoModel().initialize(model.getImageFileUploadElement()); imageFileUploadButton.addClickHandler(event -> imageFileUpload.getElement().<InputElement>cast().click()); imageFileUpload.addChangeHandler(event -> imageFileUploadLabel.setText( imageFileUpload.getFilename().replaceFirst( "^C:\\\\fakepath\\\\", ""))); }