Class QMenuItemDownloadFile
java.lang.Object
com.kingsrook.qqq.backend.core.model.metadata.menus.items.QMenuItemBase
com.kingsrook.qqq.backend.core.model.metadata.menus.items.QMenuItemDownloadFile
- All Implemented Interfaces:
QMenuItemInterface,QMetaDataObject,Serializable,Cloneable
Menu item that triggers a file download from a field in the current record.
This menu item type is used to provide download functionality for file fields (BLOB fields) or URL fields in a table. When selected, it will download the file content from the specified field.
The label for this menu item can be automatically derived from the field's metadata if not explicitly set.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.QMenuItemDownloadFile(QTableMetaData table, String fieldName) Constructor that initializes the download file item with a table and field name.QMenuItemDownloadFile(String fieldName) Constructor that initializes the download file item with a field name. -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates and returns a shallow copy of this download file menu item.Getter for fieldNameReturns the item type identifier for download file menu items.getLabel()Returns the label for this menu item, automatically deriving it from the field's metadata if not explicitly set.Returns the values map containing the field name for the download.voidsetFieldName(String fieldName) Setter for fieldNamevoidvalidate(QInstanceValidator validator, QInstance qInstance, QMetaDataObject parentObject) Validates that the download file menu item has a valid field name and that the field exists in the table.withFieldName(String fieldName) Fluent setter for fieldName
-
Constructor Details
-
QMenuItemDownloadFile
public QMenuItemDownloadFile()Default constructor. -
QMenuItemDownloadFile
Constructor that initializes the download file item with a field name.This constructor assumes the field belongs to the table that contains this menu item.
- Parameters:
fieldName- the name of the field containing the file to download
-
QMenuItemDownloadFile
Constructor that initializes the download file item with a table and field name.- Parameters:
table- the table metadata containing the field (can be null if field is in the same table as the menu)fieldName- the name of the field containing the file to download
-
-
Method Details
-
getItemType
Returns the item type identifier for download file menu items.- Returns:
- always returns "DOWNLOAD_FILE"
-
getValues
Returns the values map containing the field name for the download.- Returns:
- a map containing the field name under the key "fieldName"
-
getLabel
Returns the label for this menu item, automatically deriving it from the field's metadata if not explicitly set.If no label has been set on this menu item, this method attempts to retrieve the label from the field's metadata and sets it automatically.
- Specified by:
getLabelin interfaceQMenuItemInterface- Overrides:
getLabelin classQMenuItemBase- Returns:
- the label for this menu item
- See Also:
-
validate
public void validate(QInstanceValidator validator, QInstance qInstance, QMetaDataObject parentObject) Validates that the download file menu item has a valid field name and that the field exists in the table.Ensures that:
- A label is set (either explicitly or derived from the field)
- A field name is specified
- The field exists in the table (if parent is a QTableMetaData)
- Parameters:
validator- the validator instance to use for reporting errorsqInstance- the QQQ instance being validatedparentObject- the parent metadata object containing this menu item
-
getFieldName
-
setFieldName
-
withFieldName
Fluent setter for fieldName- Parameters:
fieldName- The field on the table holding this menu, that is either a BLOB, or a URL, which is what should be downloaded.- Returns:
- this
-
clone
Creates and returns a shallow copy of this download file menu item.- Specified by:
clonein interfaceQMenuItemInterface- Overrides:
clonein classQMenuItemBase- Returns:
- a clone of this menu item
-