it’s passable to Validate and download a file when click a download button
button.addClickListener(e->{
if(validation(Obj)
{
resource =new FileResource(new File (Obj));
}
});
boolean validation(Object obj)
{
boolean itsOk=false;
return itsOk;
}