Windows Grid dispatchers and selectors
Dispatchers and selectors are available for:
-
Column
-
Grid
-
Window
Column
Column components are needed to place Windows, they are attached to the WindowsGrid.
createColumn
Makes a new column at the end if it does not exist yet. If the column already exists, it does nothing.
Note: Dispatches an action with the type pos-web-plugin-windows-grid/CREATE_COLUMN which can be handled.
Usage
dispatchersHelper.dispatch('createColumn', { column: { id: String } });
-
column Object [REQUIRED]
The object column to be created.
-
id String [REQUIRED]
The id of the column to be created.
Example
const column = { id: 'column-1' };
dispatchersHelper.dispatch('createColumn', { column });
deleteColumn
Deletes an existing column. If the column does not exist, it does nothing.
Note: Dispatches an action with the type pos-web-plugin-windows-grid/DELETE_COLUMN which can be handled.
Usage
dispatchersHelper.dispatch('deleteColumn', { columnId: String });
-
columnId String [REQUIRED]
The id of the column to be deleted.
Example
const columnId = 'column-1';
dispatchersHelper.dispatch('deleteColumn', { columnId });
getColumnExpandedWindowId
Returns the id of the expanded window; if there is no window expanded, it returns null.
Usage
getColumnExpandedWindowId(state: Object, { columnId: String }): String
-
state Object [REQUIRED]
The global state of the application.
-
columnId String [REQUIRED]
The id of the column to search for the expanded window.
Returns
-
String
The id of the expanded window in the column; null is returned if there's no expanded window in column.
Example
const state = storeHelper.getState();
const getColumnExpandedWindowId = selectorsHelper.make('getColumnExpandedWindowId');
const columnId = 'column-1';
const windowExpanded = getColumnExpandedWindowId(state, { columnId });
getColumnIdByWindowId
Returns the id of the column where the window is located.
Usage
getColumnIdByWindowId(state: Object, { windowId: String }): String
-
state Object [REQUIRED]
The global state of the application.
-
windowId String [REQUIRED]
The id of the window to search for the column.
Returns
-
String
The id of the column where the window is located.
Example
const state = storeHelper.getState();
const getColumnIdByWindowId = selectorsHelper.make('getColumnIdByWindowId');
const windowId = 'window-1';
const columnId = getColumnIdByWindowId(state, { windowId });
getColumnWindowsIds
Returns a list with the ids of all the windows in the column.
Usage
getColumnWindowsIds(state: Object, { columnId: String }): [String]
-
state Object [REQUIRED]
The global state of the application.
-
columnId String [REQUIRED]
The id of the column where to get the windows.
Returns
-
[String]
The windows ids that are located in the column.
Example
const state = storeHelper.getState();
const getColumnWindowsIds = selectorsHelper.make('getColumnWindowsIds');
const columnId = 'window-1';
const columnWindowIds = getColumnWindowsIds(state, { columnId });
getColumnsIds
Returns a list with the ids of all the columns.
Usage
getColumnsIds(state: Object): [String]
-
state Object [REQUIRED]
The global state of the application.
Returns
-
[String]
The id list of the columns.
Example
const state = storeHelper.getState();
const getColumnsIds = selectorsHelper.make('getColumnsIds');
const columnIds = getColumnsIds(state);
Grid
Grid component is where the columns are located; it manages them and the fullscreen mode.
isFullscreen
Checks if there's a window in full screen mode.
Usage
isFullscreen(state: Object): Boolean
-
state Object [REQUIRED]
The global state of the application.
Returns
-
Boolean
true if there's a window in full screen mode, false if not.
Example
const state = storeHelper.getState();
const isFullscreen = selectorsHelper.make('isFullscreen');
const isInFullscreen = isFullscreen(state);
toggleFullscreen
It changes the fullscreen mode. If there's a window in fullscreen, it toogles to normal screen; if not, it sets the current window to full screen.
Note: Dispatches an action with the type pos-web-plugin-windows-grid/TOGGLE_FULLSCREEN which can be handled.
Usage
dispatchersHelper.dispatch('toggleFullscreen');
Window
Component created to be added to the columns.
attachWindow
It adds a window from another one. It locates the window depending on the number of the actual windows and columns.
Usage
dispatchersHelper.dispatch('attachWindow', { windowId: String });
-
windowId String [REQUIRED]
The window id where to add a window from.
Example
const windowId = 'window-id';
dispatchersHelper.dispatch('attachWindow', { windowId });
createWindow
Adds a window located in a specified column and position.
Warning: Dispatching createWindow action could cause unexpected behaviors. It is better to use the attachWindow action.
Note: Dispatches an action with the type pos-web-plugin-windows-grid/CREATE_WINDOW which can be handled.
Usage
dispatchersHelper.dispatch('createWindow', { columnId: String, window: Object, index: Number });
-
columnId String [REQUIRED]
The column id where to add the window.
-
window Object [REQUIRED]
The window to be added.
-
id String [REQUIRED]
The window id.
-
number Number [OPTIONAL]
The number to be asigned to the window. If not provided it will be the lowest available.
-
-
index Number [REQUIRED]
The index position for the window to be located in the column.
Example
const columnId = 'column-id';
const index = 1;
const window = { id: 'window-id' };
dispatchersHelper.dispatch('createWindow', { columnId, window, index });
deleteWindow
Deletes a specified window.
Note: Dispatches an action with the type pos-web-plugin-windows-grid/DELETE_WINDOW which can be handled.
Usage
dispatchersHelper.dispatch('deleteWindow', { windowId: String });
-
windowId String [REQUIRED]
The window id to be deleted.
Example
const windowId = 'window-id';
dispatchersHelper.dispatch('deleteWindow', { windowId });
disableWindowToggle
It disables the window toggle so it's not allowed to change between terminal view and GUI.
Note: Dispatches an action with the type pos-web-plugin-windows-grid/DISABLE_WINDOW_TOGGLE which can be handled.
Usage
dispatchersHelper.dispatch('disableWindowToggle', { windowId: String });
-
windowId String [REQUIRED]
The window id where the toggle will be disabled.
Example
const windowId = 'window-id';
dispatchersHelper.dispatch('disableWindowToggle', { windowId });
enableWindowToggle
It enables the window toggle to allow changing between terminal view and GUI (if there's a GUI available).
Note: Dispatches an action with the type pos-web-plugin-windows-grid/ENABLE_WINDOW_TOGGLE which can be handled.
Usage
dispatchersHelper.dispatch('enableWindowToggle', { windowId: String });
-
windowId String [REQUIRED]
The window id where the toggle will be enabled.
Example
const windowId = 'window-id';
dispatchersHelper.dispatch('enableWindowToggle', { windowId });
expandWindow
It sets the expanded window within the column. Set null value for not expanded window in the column.
Note: Dispatches an action with the type pos-web-plugin-windows-grid/EXPAND_WINDOW which can be handled.
Usage
dispatchersHelper.dispatch('expandWindow', { columnId: String, windowId: String | null });
-
columnId String [REQUIRED]
The column to set the expanded window.
-
windowId String [REQUIRED]
The window id to be expanded; set to null for no window expansion.
Example
const columnId = 'column-id';
const windowId = 'window-id';
dispatchersHelper.dispatch('expandWindow', { columnId, windowId });
getCurrentWindowId
Returns the id of the current window.
Usage
getCurrentWindowId(state: Object): String
-
state Object [REQUIRED]
The global state of the application.
Returns
-
String
The current window id.
Example
const state = storeHelper.getState();
const getCurrentWindowId = selectorsHelper.make('getCurrentWindowId');
const currentWindowId = getCurrentWindowId(state);
getWindowHostConnectionId
Returns the host connection id of the related window.
Usage
getWindowHostConnectionId(state: Object{ windowId: String }): String
-
state Object [REQUIRED]
The global state of the application.
-
windowId Object [REQUIRED]
The window id of the window.
Returns
-
String
The window host connection id.
Example
const state = storeHelper.getState();
const getWindowHostConnectionId = make('getWindowHostConnectionId');
const windowId = 'window-id';
const hostConnectionId = getWindowHostConnectionId(state, { windowId });
getWindowIdByNumber
Returns the window id based on the number.
Usage
getWindowIdByNumber(state: Object{ number: Number }): String
-
state Object [REQUIRED]
The global state of the application.
-
number Number [REQUIRED]
The number of the window to look for.
Returns
-
String
The window id.
Example
const state = storeHelper.getState();
const getWindowIdByNumber = make('getWindowIdByNumber');
const number = 1;
const windowId = getWindowIdByNumber(state, { number });
getWindowLayoutId
Returns the layout of a window based on its id.
Usage
getWindowLayoutId(state: Object{ windowId: String }): String
-
state Object [REQUIRED]
The global state of the application.
-
windowId Object [REQUIRED]
The window id to look for the layout.
Returns
-
String
The layout id.
Example
const state = storeHelper.getState();
const getWindowLayoutId = make('getWindowLayoutId');
const windowId = 'window-id';
const windowLayoutId = getWindowLayoutId(state, { windowId });
getWindowNumber
Returns the number of a window based on its id.
Usage
getWindowNumber(state: Object{ windowId: String }): Number
-
state Object [REQUIRED]
The global state of the application.
-
windowId Object [REQUIRED]
The window id to look for the layout.
Returns
-
Number
The number of the window.
Example
const state = storeHelper.getState();
const getWindowNumber = selectorsHelper.make('getWindowNumber');
const windowId = 'window-id';
const windowNumber = getWindowNumber(state, { windowId });
getWindowTitle
Returns the window title based on its id.
Usage
getWindowTitle(state: Object{ windowId: String }): Number
-
state Object [REQUIRED]
The global state of the application.
-
windowId Object [REQUIRED]
The window id to look for the layout.
Returns
-
String
The window title.
Example
const state = storeHelper.getState();
const getWindowTitle = selectorsHelper.make('getWindowTitle');
const windowId = 'window-id';
const windowTitle = getWindowTitle(state, { windowId });
getWindowsIds
Returns a list with the ids of all the windows that are created.
Usage
getWindowsIds(state: Object): [String]
-
state Object [REQUIRED]
The global state of the application.
Returns
-
String
The list with all the ids of all the created windows.
Example
const state = storeHelper.getState();
const getWindowsIds = selectorsHelper.make('getWindowsIds');
const windowsIds = getWindowsIds(state);
getWindowsNumbers
Returns a list with the numbers of all the windows that are created.
Usage
getWindowsNumbers(state: Object): [Number]
-
state Object [REQUIRED]
The global state of the application.
Returns
-
Number
The list with all the numbers of all the created windows.
Example
const state = storeHelper.getState();
const getWindowsNumbers = selectorsHelper.make('getWindowsNumbers');
const windowsNumbers = getWindowsNumbers(state);
isWindowCreated
Checks if a terminal has been already created or not.
Usage
isWindowCreated(state: Object, { windowI: String }): Boolean;
-
state Object [REQUIRED]
The global state of the application.
-
windowId Object [REQUIRED]
The id of the window to check if has been created or not.
Returns
-
Boolean
true if the window is already created, false if not.
Example
const state = storeHelper.getState();
const isWindowCreated = selectorsHelper.make('isWindowCreated');
const windowId = 'window-1';
const isCreated = isWindowCreated(state, { windowId });
isWindowGraphicalView
Checks if the window is showing a graphical content.
Usage
isWindowGraphicalView(state: Object, { windowI: String }): Boolean;
-
state Object [REQUIRED]
The global state of the application.
-
windowId String [REQUIRED]
The id of the terminal to be checked.
Returns
-
Boolean
true if the window is on graphical view, false if not.
Example
const state = storeHelper.getState();
const isWindowGraphicalView = selectorsHelper.make('isWindowGraphicalView');
const windowId = 'window-1';
const isGraphicalView = isWindowGraphicalView(state, { windowId });
isWindowGraphicalViewToggleEnabled
Checks if WindowGraphicalView button is toggle enabled.
Usage
isWindowGraphicalViewToggleEnabled(state: Object, { windowI: String }): Boolean;
-
state Object [REQUIRED]
The global state of the application.
-
windowId String [REQUIRED]
The id of the terminal to be checked.
Returns
-
Boolean
true if the WindowGraphicalView button is toggle enabled, false if not.
Example
const state = storeHelper.getState();
const isWindowGraphicalViewToggleEnabled = selectorsHelper.make(
'isWindowGraphicalViewToggleEnabled',
);
const windowId = 'window-1';
const isToggleEnabled = isWindowGraphicalViewToggleEnabled(state, { windowId });
isFullscreenToggleEnabled
Checks if Fullscreen button is toggle enabled.
Usage
isFullscreenToggleEnabled(state: Object, { windowI: String }): Boolean;
-
state Object [REQUIRED]
The global state of the application.
-
windowId String [REQUIRED]
The id of the terminal to be checked.
Returns
-
Boolean
true if the Fullscreen button is toggle enabled, false if not.
Example
const state = storeHelper.getState();
const isFullscreenToggleEnabled = selectorsHelper.make('isFullscreenToggleEnabled');
const windowId = 'window-1';
const isToggleEnabled = isFullscreenToggleEnabled(state, { windowId });
replaceCurrentWindowId
Changes the current window.
Usage
dispatchersHelper.dispatch('replaceCurrentWindowId', { windowI: String });
-
windowId String [REQUIRED]
The id of the terminal that we want to modify.
Example
dispatchersHelper.dispatch('replaceCurrentTerminalId', { windowId: 'window-1' });
replaceWindowHostConnectionId
Changes the host connection of a specified window.
Usage
dispatchersHelper.dispatch('replaceTerminalHostConnectionId', {
windowId: String,
hostConnectionId: String,
});
-
windowId String [REQUIRED]
The id of the terminal that we want to modify.
-
hostConnectionId String [REQUIRED]
The new host connection id.
Example
dispatchersHelper.dispatch('replaceTerminalHostConnectionId', {
windowId: 'window-1',
hostConnectionId: 'host-connection-1',
});
replaceWindowLayoutId
Changes the layout of a specified window.
Note: Dispatches an action with the type pos-web-plugin-windows-grid/REPLACE_WINDOW_LAYOUT_ID which can be handled.
Usage
dispatchersHelper.dispatch('replaceWindowLayoutId', {
windowId: String,
layoutId: String,
buttons: Object,
});
-
windowId String [REQUIRED]
The id of the terminal that we want to modify.
-
layoutId String [REQUIRED]
The new layout id.
-
buttons Object [OPTIONAL]
Can overwrite if the WindowGraphicalView and Fullscreen buttons from the window are enabled or not. The default value is true.
Example
dispatchersHelper.dispatch('replaceWindowLayoutId', {
windowId: 'window-1',
layoutId: 'layout-1',
});
dispatchersHelper.dispatch('replaceWindowLayoutId', {
windowId: 'window-1',
layoutId: 'layout-1',
buttons: {
isFullscreenToggleEnabled: false,
},
});
dispatchersHelper.dispatch('replaceWindowLayoutId', {
windowId: 'window-1',
layoutId: 'layout-1',
buttons: {
isWindowGraphicalViewToggleEnabled: false,
},
});
replaceWindowTitle
Changes the title of a specified window.
Note: Dispatches an action with the type pos-web-plugin-windows-grid/REPLACE_WINDOW_TITLE which can be handled.
Usage
dispatchersHelper.dispatch('replaceWindowTitle', {
windowId: String,
title: String,
});
-
windowId String [REQUIRED]
The id of the terminal that we want to modify.
-
title String [REQUIRED]
The new title.
Example
dispatchersHelper.dispatch('replaceWindowLayoutId', {
windowId: 'window-1',
title: 'New title',
});
toggleWindowGraphicalView
Toggles between the terminal and graphical view.
Note: Dispatches an action with the type pos-web-plugin-windows-grid/TOGGLE_WINDOW_GRAPHICAL_VIEW which can be handled.
Usage
dispatchersHelper.dispatch('toggleWindowGraphicalView', { windowId: String });
-
windowId String [REQUIRED]
The id of the window to toggle the graphical view.
Example
dispatchersHelper.dispatch('toggleWindowGraphicalView', { windowId: 'window-1' });