This application component let's you define launcher commands at runtime that can be directly executed via a search box.
Instant launcher uses rich-search under the hood. It adds a specific search result type to the search results of rich-search
called Launcher Commands
. Those Launcher Commands are configurations or scripts, that can be defined at runtime of the application.
instant-launcher
is available in the CUBA marketplace- Select a version of the add-on which is compatible with the platform version used in your project:
Platform Version | Add-on Version |
---|---|
7.2.x | 0.5.x |
7.1.x | 0.4.x |
7.0.x | 0.2.x - 0.3.x |
6.10.x | 0.1.x |
Add custom application component to your project:
- Artifact group:
de.diedavids.cuba.instantlauncher
- Artifact name:
instantlauncher-global
- Version: add-on version
dependencies {
appComponent("de.diedavids.cuba.instantlauncher:instantlauncher-global:*addon-version*")
}
To see this application component in action, check out this example: cuba-example-using-instant-launcher.
Information on changes that happen through the different versions of the application component can be found in the CHANGELOG. The Changelog also contains information about breaking changes and tips on how to resolve them.
The following databases are supported by this application component:
- HSQLDB
- PostgreSQL
- MySQL
All other DBMS systems are also possible to work with by the fact that CUBA studio generates the corresponding init / update scripts within the application.
The instant-launcher
application component let's you define Launcher Commands
at runtime that can be
executed as shortcuts via the global search box or a global keyboard shortcut.
Example Launcher Commands:
- opening the screen to create a new user
- shortcut for running a specific report and starts the download of the file
- executing arbitrary business logic like
The following types of instant launchers are supported:
- Screen Launchers
- Script Launchers
- Bean Launchers
It is possible to configure a Keyboard Shortcut to a particular Launcher Command. This Shortcut is globally available in the application.
Example:
CTRL-ALT-U
- Launcher Command: Create a new User
Next to performing a launcher command via a Keyboard Shortcut, it is also possible to enable Launcher Commands in the Main Menu of the application. In this case the Launcher Command is shown as a Menu item that is executed on clicking the menu item.
With this in combination with Screen Launcher Commands it is possible to e.g. define "Menu-Favorites" or any other quick action, that should be available via the Main Menu.
In case the Launcher Command is organized in a Launcher Command Group, the corresponding group acts as a Main Menu Entry, which then as Sub Menu Items contains all launcher commands that are associated to the group.
In order to leverage the capabilities of the instant-launcher application component, it is required to activate it in the main window.
The add-on provides preconfigured main windows screens, that can be configured to activate the add-on behavior:
Set the mainScreenId for the application via web-app.properties
:
cuba.web.mainScreenId
cuba.web.mainScreenId=instantLauncherTopMenuMainScreen
- for Top Menu Layoutcuba.web.mainScreenId=instantLauncherSideMenuMainScreen
- for Side Menu Layoutcuba.web.mainScreenId=instantLauncherResponsiveSideMenuMainScreen
- for responsive Side Menu Layout
In case your application already contains a custom Main Window, the following code has to be placed in order to activate the desired behavior of the add-on.
- before the main screen is shown, the shortcut initializer has to be triggered:
import de.diedavids.cuba.instantlauncher.web.launcher.LauncherCommandsInitializer;
@UiController("customApplicationMainScreen")
@UiDescriptor("custom-application-main-screen.xml")
public class InstantLauncherTopMenuMainScreen extends MainScreen implements Window.HasFoldersPane {
// ...
@Inject
protected LauncherCommandsInitializer launcherCommandShortcutInitializer;
@Inject
protected AppMenu mainMenu;
@Subscribe
protected void onBeforeShow(BeforeShowEvent event) {
launcherCommandShortcutInitializer.initKeyboardShortcuts(
(RootWindow) this.getWindow()
);
launcherCommandShortcutInitializer.initMenuLauncherCommands(
AppMenuAdapter.of(mainMenu)
);
}
// ...
}
- the rich-search bar has to be placed in the main screen and the
ddcil_launcherCommandSearchStrategy
has to be activated for the search bar:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
xmlns:search="http://schemas.haulmont.com/cuba/search.xsd">
caption="mainMsg://application.caption">
<layout expand="foldersSplit">
<hbox id="titleBar"
stylename="c-app-menubar"
expand="mainMenu"
width="100%"
spacing="true"
margin="false;false;false;true">
<image id="logoImage"
align="MIDDLE_LEFT"
scaleMode="SCALE_DOWN"
stylename="c-app-icon"/>
<menu id="mainMenu"
align="MIDDLE_LEFT"/>
<search:richSearch id="search"
align="MIDDLE_LEFT"
inputPrompt="msg://search"
suggestionsLimit="200">
<search:strategyBean name="search_MainMenuSearchStrategy"/>
<search:strategyBean name="ddcil_launcherCommandSearchStrategy" />
</search:richSearch>
<!-- ... -->
</hbox>
<!-- ... -->
</layout>
</window>
It is also possible to parametrise Launcher Commands. Defining a parameter for a Launcher Command results in a Dialog window, that asks the user to enter values for the parameters.
A Launch Command can have multiple parameters, where a parameter can have the following types:
- String
- Number (Integer, Double, BigDecimal)
- Boolean
- Date (Date, DateTime, LocalDate, LocalDateTime)
- Enum
- Entity