Breadcrumb
- Sabre Red 360 Software Development Kit Help
- Desktop Red Apps
- Red App Sample Plug-ins
- com.sabre.redapp.example3.desktop.hint Sample
com.sabre.redapp.example3.desktop.hint Sample
Hints
Hints are information suggesting some information is missing or is inappropriate. It’s presented in horizontal bar displayed in the output area. Along with the message there is button allowing to add some action in order to perform suggested change. It is in most cases modal that can allow to insert and submit lacking data.
Usage
Backend
public FlowExtPointCommand execute(FlowExtPointCommand extPointCommand)
{
addPnrElementsMissingError(extPointCommand, "error indicating missing element");
return extPointCommand;
}
private void addPnrElementsMissingError(FlowExtPointCommand cmd, String message)
{
FlowExtPointError error = createMajorError(PNR_ELEMENTS_MISSING_ERROR_TITLE, message, null);
error.getHints().add(buildHint());
addError(cmd, error);
}
private FlowExtPointHint buildHint()
{
return new FlowExtPointHint()
.withLabel(HINT_BUTTON_LABEL)
.withActionCode(HINT_ACTION_CODE)
.withButtonType(FlowExtPointButtonType.PRIMARY);
}
Frontend
For given extension point service hint title and hintAction can be added.
xp.addConfig('hintAction', new HintXPConfig(hintAction));
first argument describing hint need to be the same as the one in backend service. It needs to be unique, it cannot be repeated, don’t copy and paste from this sample. Use for example your package name string like - "com.sabre.redapp.example3.desktop.hint":
private static final String HINT_ACTION_CODE = "hintAction";
Sample hintAction can look like this
export function hintAction() {
getService(LayerService).showInModal(new HintSampleView(),
{ title: 'Sample action', display: 'areaView' });
}
It displays some information in modal after clicking button in hint bar.