Prompt Style
The promptStyle() element is used to specify whether, when invoking an action associated with a domain object property, the parameters for the action are prompted either in modal dialog box, a (non-modal) sidebar dialog box, or is prompted using an inline panel (replacing the property on the page). For more on sidebar vs modal dialogs, see Wicket viewer features.
The prompt style is influenced by two configuration properties:
-
if the promptStyle() element is set to
DIALOG, then a configuration property is used to determine whether to render using a modal dialog or a sidebar:-
causeway.viewer.wicket.dialog-mode if the action is for a domain object (entity or view model)
If the configuration property is not set, then sidebar is used.
-
causeway.viewer.wicket.dialog-mode-for-menu if the action is for a domain service
If the configuration property is not set, then modal is used.
-
-
if the attribute is not set at all, then thecauseway.viewer.wicket.prompt-style configuration property is used to specify the preferred prompt style.
If the configuration property is not set, then an inline prompt is used.
And, if this is set but is set to just
DIALOG, then the causeway.viewer.wicket.dialog-mode configuration property determines which style.
For example:
import lombok.Getter;
import lombok.Setter;
public class Customer {
@Property(editing = Editing.DISABLED) (1)
@Getter @Setter
private String notes;
@Action(associateWith="notes") (2)
@ActionLayout(
promptStyle=PromptStyle.INLINE (3)
)
public Customer updateNotes(String notes) {
// ...
}
}
| 1 | property is not editable |
| 2 | instead, associate this action with the "notes" property |
| 3 | prompt for the action’s parameters using an inline panel. |
Exactly one action for a given property can be specified with INLINE_AS_IF_EDIT.
Assuming that the corresponding property is not itself editable, this means that the property will be rendered as if it is editable, but the action’s prompt form will be rendered instead.
The net effect is that a property conceptually consisting of different parts (eg a name, an address or a date) can be updated using an action that lets each separate part be specified independently.