Interface ForeignKeyEditorLink.Builder<R extends EntityEditor<R>>
- Type Parameters:
R- theEntityEditortype
- All Superinterfaces:
EditorLink.Builder<R>
- Enclosing interface:
ForeignKeyEditorLink
ForeignKeyEditorLink.-
Nested Class Summary
Nested classes/interfaces inherited from interface is.codion.framework.model.EditorLink.Builder
EditorLink.Builder.EditorStep, EditorLink.Builder.ForeignKeyNameStep<R extends EntityEditor<R>>, EditorLink.Builder.LoadStep<R extends EntityEditor<R>> -
Method Summary
Modifier and TypeMethodDescriptionbeforeInsert(EditorLink.BeforeInsert beforeInsert) Overrides theEditorLink.BeforeInsertaction.build()Sets the link caption.condition(EditorLink.DetailCondition condition) Overrides the defaultEditorLink.DetailCondition.entity(EditorLink.DetailEntity entity) Overrides the defaultEditorLink.DetailEntity.Overrides the auto-derived link name.Sets the presence predicate for the detail editor.select(EditorLink.DetailSelect select) Overrides the defaultEditorLink.DetailSelect.
-
Method Details
-
name
Overrides the auto-derived link name.
By default, FK-based links use
foreignKey.name()as the link identifier. Override this when registering multiple FK-based detail editors that share the same foreign key but differ bycondition(e.g., a single department's "manager" and "department head" details, both viaEmployee.DEPARTMENT_FKbut filtered by differentJOBvalues). Without an override the two would collide on the auto-derived name. After overriding, look up viaEntityEditor.DetailEditors.get(String)rather thanEntityEditor.DetailEditors.get(ForeignKey).- Parameters:
name- the link name, unique within the master's detail editors- Returns:
- this builder
- Throws:
IllegalArgumentException- if the name is null or empty
-
condition
Overrides the default
EditorLink.DetailCondition.Note that this overrides
select(DetailSelect). Useful when the relationship is the FK plus an additional filter (e.g.,FK = master AND JOB = MANAGER).- Parameters:
condition- the condition used to load the detail row- Returns:
- this builder
-
select
Overrides the default
EditorLink.DetailSelect. Useful when the relationship is the FK plus an additional filter (e.g.,FK = master AND JOB = MANAGER).- Parameters:
select- the select used to load the detail row- Returns:
- this builder
-
entity
Overrides the default
EditorLink.DetailEntity. Useful when the relationship can not be represented with aEntityConnection.SelectorCondition.- Parameters:
entity- provides the detail row when loading- Returns:
- this builder
-
present
Description copied from interface:EditorLink.BuilderSets the presence predicate for the detail editor.
At registration time (
EntityEditor.DetailEditors.add(EditorLink)) the supplied predicate is installed on the detail editor'sEntityEditor.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.- Specified by:
presentin interfaceEditorLink.Builder<R extends EntityEditor<R>>- Parameters:
present- the presence predicate- Returns:
- this builder
-
beforeInsert
Description copied from interface:EditorLink.BuilderOverrides 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.
- Specified by:
beforeInsertin interfaceEditorLink.Builder<R extends EntityEditor<R>>- Parameters:
beforeInsert- the action applied to the detail prior to insertion- Returns:
- this builder
-
caption
Description copied from interface:EditorLink.BuilderSets 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.- Specified by:
captionin interfaceEditorLink.Builder<R extends EntityEditor<R>>- Parameters:
caption- the link caption- Returns:
- this builder
-
build
ForeignKeyEditorLink build()- Specified by:
buildin interfaceEditorLink.Builder<R extends EntityEditor<R>>- Returns:
- a new
ForeignKeyEditorLink
-