- All Known Subinterfaces:
ForeignKeyEditorLink.Builder
- Enclosing interface:
EditorLink
Builds an EditorLink.
The required steps are:
EditorLink.Builder.EditorStep.editor(EntityEditor)— bind the detail editor.- Then either
EditorLink.Builder.ForeignKeyNameStep.foreignKey(ForeignKey)(FK case, all callbacks defaulted from the FK) orEditorLink.Builder.ForeignKeyNameStep.name(String)followed byEditorLink.Builder.LoadStep.condition(DetailCondition),EditorLink.Builder.LoadStep.select(DetailSelect)orEditorLink.Builder.LoadStep.entity(DetailEntity)(non-FK case).
present(Predicate) and beforeInsert(BeforeInsert) are optional.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThe first step — binds the detail editor that the link will describe.static interfaceThe second step — choose whether the link is foreign-key based or named.static interfaceRequired afterEditorLink.Builder.ForeignKeyNameStep.name(String)— supplies the load source for the detail entity, expressed as aEditorLink.DetailCondition,EditorLink.DetailSelectorEditorLink.DetailEntity. -
Method Summary
Modifier and TypeMethodDescriptionbeforeInsert(EditorLink.BeforeInsert beforeInsert) Overrides theEditorLink.BeforeInsertaction.build()Sets the link caption.clearEmpty(boolean clearEmpty) Specifies whether to clear all values instead of setting defaults when the detail editor is emptied on load, when no detail entity exists.Sets the presence predicate for the detail editor.
-
Method Details
-
present
Sets the presence predicate for the detail editor.
At registration time (
EntityEditor.DetailEditors.add(EditorLink)) the supplied predicate is installed on the detail editor'sEntityEditor.EditorEntity.present()state, replacing any previously-set predicate (it is not wrapped). The predicate is then locked: subsequent attempts to replace it viaEntityEditor.Present.predicate()will fail. If a custom presence predicate is needed on a detail editor, supply it here rather than setting it directly on the editor before registration.- Parameters:
present- the presence predicate- Returns:
- this builder
-
beforeInsert
Overrides the
EditorLink.BeforeInsertaction.For FK-based links this overrides the default FK-set; the user must still ensure the foreign key gets set correctly if the framework's default is replaced.
- Parameters:
beforeInsert- the action applied to the detail prior to insertion- Returns:
- this builder
-
caption
Sets the link caption.
The caption is the human-readable label used by the UI layer when disambiguating components — for example, the suffix in the "Select input field" dialog when the same attribute appears in multiple slots (
"Tag (1)","Tag (Manager)").Defaults to the link name. Override when the link name is a structural identifier (e.g., the auto-derived
foreignKey.name()or sequential numbers used to keep slot names unique) and a different label reads better in the UI.- Parameters:
caption- the link caption- Returns:
- this builder
- Throws:
IllegalArgumentException- if the caption is null or empty
-
clearEmpty
Specifies whether to clear all values instead of setting defaults when the detail editor is emptied on load, when no detail entity exists.- Parameters:
clearEmpty- specifies whether to clear the values when the editor is emptied- Returns:
- this builder
-
build
EditorLink build()- Returns:
- a new
EditorLink
-