# FilePropertyDescriptor

Import: `import com.install4j.api.beaninfo.FilePropertyDescriptor;`

```java
public class FilePropertyDescriptor extends Install4JPropertyDescriptor
```

Property descriptor for properties that contain one or several file.
The supported property types are
- java.io.File
- [`ExternalFile`](../beans/ExternalFile.md)
- [`LocalizedExternalFile`](../beans/LocalizedExternalFile.md)
- File[]

Using this class is not strictly required. In principle, you could also set values for the `ATTRIBUTE_*` constants in the property descriptor
of an unrelated property descriptor class.


**See also:**

- [ExternalFile](../beans/ExternalFile.md)
- [LocalizedExternalFile](../beans/LocalizedExternalFile.md)

## Inherited from

- [Install4JPropertyDescriptor](Install4JPropertyDescriptor.md) — 23 methods, 35 fields

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`create(String, Class, String, String, FileSelectionMode)`](#create-string-class-string-string-fileselectionmode) | `FilePropertyDescriptor` | Same as [`FilePropertyDescriptor.create`](FilePropertyDescriptor.md#create-string-class-string-string-fileselectionmode-string-string-string) with `suffixes`, `filterName` and `context` set to `null`. |
| [`create(String, Class, String, String, FileSelectionMode, String)`](#create-string-class-string-string-fileselectionmode-string) | `FilePropertyDescriptor` | Same as [`FilePropertyDescriptor.create`](FilePropertyDescriptor.md#create-string-class-string-string-fileselectionmode-string-string-string) with `suffixes` and `filterName` set to `null`. |
| [`create(String, Class, String, String, FileSelectionMode, String[], String)`](#create-string-class-string-string-fileselectionmode-string-string) | `FilePropertyDescriptor` | Same as [`FilePropertyDescriptor.create`](FilePropertyDescriptor.md#create-string-class-string-string-fileselectionmode-string-string-string) with `context` set to `null`. |
| [`create(String, Class, String, String, FileSelectionMode, String[], String, String)`](#create-string-class-string-string-fileselectionmode-string-string-string) | `FilePropertyDescriptor` | Create a file property descriptor as with [`Install4JPropertyDescriptor.create`](Install4JPropertyDescriptor.md#create-string-class-string-string) and additional configuration specific to file properties. |
| [`setFileContentType(FileContentType)`](#setfilecontenttype-filecontenttype) | `FilePropertyDescriptor` | Set the file content type. |

### create(String, Class, String, String, FileSelectionMode)

```java
public static FilePropertyDescriptor create(String propertyName, Class beanClass, String displayName, String shortDescription, FileSelectionMode selectionMode)
```

Same as [`FilePropertyDescriptor.create`](FilePropertyDescriptor.md#create-string-class-string-string-fileselectionmode-string-string-string)
with `suffixes`, `filterName` and `context` set to `null`.

### create(String, Class, String, String, FileSelectionMode, String)

```java
public static FilePropertyDescriptor create(String propertyName, Class beanClass, String displayName, String shortDescription, FileSelectionMode selectionMode, String context)
```

Same as [`FilePropertyDescriptor.create`](FilePropertyDescriptor.md#create-string-class-string-string-fileselectionmode-string-string-string)
with `suffixes` and `filterName` set to `null`.

### create(String, Class, String, String, FileSelectionMode, String[], String)

```java
public static FilePropertyDescriptor create(String propertyName, Class beanClass, String displayName, String shortDescription, FileSelectionMode selectionMode, String[] suffixes, String filterName)
```

Same as [`FilePropertyDescriptor.create`](FilePropertyDescriptor.md#create-string-class-string-string-fileselectionmode-string-string-string)
with `context` set to `null`.

### create(String, Class, String, String, FileSelectionMode, String[], String, String)

```java
public static FilePropertyDescriptor create(String propertyName, Class beanClass, String displayName, String shortDescription, FileSelectionMode selectionMode, String[] suffixes, String filterName, String context)
```

Create a file property descriptor as with [`Install4JPropertyDescriptor.create`](Install4JPropertyDescriptor.md#create-string-class-string-string)
and additional configuration specific to file properties.


**Parameters:**

- `selectionMode` — the file selection mode when the user invokes the file chooser
- `suffixes` — the accepted suffixes in the file chooser
- `filterName` — the filter name in the file chooser
- `context` — the context. The context allows specifying different editors for the same property types.
See the `CONTEXT_*` properties for the built-in contexts.

**Returns:** the property descriptor

### setFileContentType(FileContentType)

```java
public FilePropertyDescriptor setFileContentType(FileContentType fileContentType)
```

Set the file content type. The install4j IDE can create some file types
as described in the documentation for [`FileContentType`](FileContentType.md).
If you do not call this method, users will only be able to select the file, but there will be
no way to create or edit a selected file.


**Parameters:**

- `fileContentType` — the file content type

**Returns:** `this`, for chained calls on this property descriptor

## Fields

| Field | Type | Description |
|---|---|---|
| [ATTRIBUTE_SELECTION_MODE](#attribute-selection-mode) | `String` |  |
| [ATTRIBUTE_SUFFIXES](#attribute-suffixes) | `String` |  |
| [ATTRIBUTE_FILTER_NAME](#attribute-filter-name) | `String` |  |
| [ATTRIBUTE_FILE_CONTENT_TYPE](#attribute-file-content-type) | `String` |  |
| [CONTEXT_EXTERNAL_OR_INTERNAL](#context-external-or-internal) | `String` | Special context for properties of type `com.install4j.api.beans.ExternalFile` that tells the install4j GUI to offer the user the possibility to select a file from the distribution tree instead. |

### ATTRIBUTE_SELECTION_MODE

```java
public static final String ATTRIBUTE_SELECTION_MODE = "selectionMode"
```

### ATTRIBUTE_SUFFIXES

```java
public static final String ATTRIBUTE_SUFFIXES = "suffixes"
```

### ATTRIBUTE_FILTER_NAME

```java
public static final String ATTRIBUTE_FILTER_NAME = "filterName"
```

### ATTRIBUTE_FILE_CONTENT_TYPE

```java
public static final String ATTRIBUTE_FILE_CONTENT_TYPE = "fileContentType"
```

### CONTEXT_EXTERNAL_OR_INTERNAL

```java
public static final String CONTEXT_EXTERNAL_OR_INTERNAL = "externalOrInternal"
```

Special context for properties of type `com.install4j.api.beans.ExternalFile` that tells the install4j GUI
to offer the user the possibility to select a file from the distribution tree instead. The selected file
will then be prepended with `${installer:sys.installationDir}` and will not be packaged separately.
In that case, the enclosing action or screen can only be used if the "Install files" action has already run.

