Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sapphire-dev] Question on Path based ValeProperty

The browse dialog can’t apply the validators because the validators run on the property, not an arbitrary value that hasn’t been written to model yet. The other problem is that the validators could flag an error when a legitimate file is chosen due to unrelated issues in the model. We could conceivable add a separate API specifically targeting at customizing filtering in the browse dialog box, but expensive filtering logic (such as opening a file to read its content) is typically ill-advised since it can slow the dialog to a crawl. Another issue is that system browse dialogs do not have support for pluggable filtering, so we could only support such a feature when browsing for workspace resources.

 

- Konstantin

 

 

From: Shenxue Zhou [mailto:shenxue.zhou@xxxxxxxxxx]
Sent: Thursday, June 12, 2014 8:35 AM
To: Konstantin Komissarchik
Subject: Question on Path based ValeProperty

 

I have the following property:

 

                @Type( base = Path.class )

                @XmlBinding( path = "document" )

                @Label(standard = "document")

                @FileExtensions( expr = "xml" )

                @ProjectRelativePath

                @ValidFileSystemResourceType( FileSystemResourceType.FILE )

                @Services

                (

                                 {

          @Service( impl = ADFArtifactsPathService.class ),

          @Service( impl = TaskFlowCallValidator.class )

}

                )

               

                ValueProperty PROP_DOCUMENT = new ValueProperty( TYPE, "Document" ); 

                Value<Path> getDocument();

                void setDocument(String value);

                void setDocument(Path value);

 

When this property is rendered in a form, it has a “browse” button which launches File Picker dialog. This dialog filters out any files with non-xml extension. But it doesn’t apply the attached validator. So a common case is as soon as a file is selected and the dialog is dismissed, an error mark would show up in the property editor.

 

Could the file picker dialog apply the validator so only valid file is chosen?

 

Thanks,

 

Shenxue


Back to the top