Static Public Attributes | |
static final Set< MessageField > | MSGTYPES_CANNOT_OVERRIDE |
The menu manager server component manages a menu tree locally, handling updates to both state and items, and also dealing with any remote connections. To listen to updates you generally register a MenuManagerListener that will receive updates as items change. These listeners can also register themselves to handle list selection changes and also to provide values for ScrollChoiceMenuItems.
In terms of remotes, many types of remote connections can be added, each type of remote is registered as a ServerConnectionManager that handles one or more remote connection. This manager object provides much of the functionality around managing connections, including joining, pairing, bootstrapping, handling the messages and dealing with heartbeats.
Any authentication that is required is dealt with by an instance of MenuAuthenticator.
void com.thecoderscorner.menu.mgr.MenuManagerServer.addConnectionManager | ( | ServerConnectionManager | manager | ) |
Add a connection manager to the list of connection managers. This will be started during start and any connections that are created will be serviced by this manager
manager | a new connection manager |
void com.thecoderscorner.menu.mgr.MenuManagerServer.addCustomMessageProcessor | ( | MessageField | msgType, |
BiConsumer< MenuManagerServer, MenuCommand > | processor | ||
) |
Allows user level additional message processors for custom messages. Using this you can provide your own message type at the API protocol level, and then use this to apply the additional functionality to the manager. The provided consumer will be called each time this custom message is applied. Note that you cannot override the core security based message types, any attempt to do so results in an exception.
msgType | the message type for your custom message |
processor | the processor to handle the message. |
void com.thecoderscorner.menu.mgr.MenuManagerServer.addMenuManagerListener | ( | MenuManagerListener | listener | ) |
Add a listener that will receive menu item events, such as when items change, and also when scroll choice values are needed. In addition to the menuHasChanged() method you can register additional methods marking them with the MenuCallback annotation, and for every scroll choice item, you should register a value retrieval method using ScrollChoiceValueRetriever
listener | the new listener |
void com.thecoderscorner.menu.mgr.MenuManagerServer.addTreeStructureChangeListener | ( | MenuTreeStructureChangeListener | structureListener | ) |
Add a callback that will run when the tree has structurally changed. IE when items are added or removed from sub menus
structureListener | the listener |
void com.thecoderscorner.menu.mgr.MenuManagerServer.connectionCreated | ( | ServerConnection | connection | ) |
Indicates that a connection has been created, implementing the NewServerConnectionListener. For this we register ourselves as the message handler and send initial commands
connection | the new connection |
Implements com.thecoderscorner.menu.mgr.NewServerConnectionListener.
List<ServerConnection> com.thecoderscorner.menu.mgr.MenuManagerServer.getAllServerConnections | ( | ) |
MenuAuthenticator com.thecoderscorner.menu.mgr.MenuManagerServer.getAuthenticator | ( | ) |
DialogManager com.thecoderscorner.menu.mgr.MenuManagerServer.getDialogManager | ( | ) |
MenuTree com.thecoderscorner.menu.mgr.MenuManagerServer.getManagedMenu | ( | ) |
String com.thecoderscorner.menu.mgr.MenuManagerServer.getServerName | ( | ) |
UUID com.thecoderscorner.menu.mgr.MenuManagerServer.getServerUuid | ( | ) |
boolean com.thecoderscorner.menu.mgr.MenuManagerServer.isAnyRemoteConnection | ( | ) |
Indicates if there is a remote connection on any of the server connection managers
void com.thecoderscorner.menu.mgr.MenuManagerServer.menuItemDidUpdate | ( | Object | sender, |
MenuItem | item | ||
) |
Tell the manager that an update has already occurred, IE the menu tree state is already adjusted. This just notifies locally and remotely.
item | the item that has adjusted |
void com.thecoderscorner.menu.mgr.MenuManagerServer.sendCommand | ( | MenuCommand | command | ) |
Send a command to all remotes that are connected.
command | the command to send |
void com.thecoderscorner.menu.mgr.MenuManagerServer.setBoardSerialProvider | ( | Supplier< Integer > | provider | ) |
Allows for customization of the board serial number as a Supplier of Long. This will be called whenever the serial number is needed, and should return the value promptly to avoid connectivity issues.
provider | the function that returns the serial number when requested. |
void com.thecoderscorner.menu.mgr.MenuManagerServer.setDialogManager | ( | DialogManager | manager | ) |
replace the dialog manager with another implementation. By default, this class starts with an empty dialog manager that can be replaced with a more suitable implementation
manager | the replacement dialog manager |
void com.thecoderscorner.menu.mgr.MenuManagerServer.start | ( | ) |
Start the manager and all associated server connection managers
void com.thecoderscorner.menu.mgr.MenuManagerServer.stop | ( | ) |
Stop the manager all associated resources
void com.thecoderscorner.menu.mgr.MenuManagerServer.treeStructurallyChanged | ( | MenuItem | hint | ) |
Tell the manager that the tree has structurally changed and that any interested parties need notification.
hint | either MenuTree.ROOT or another item in the tree |
void com.thecoderscorner.menu.mgr.MenuManagerServer.updateMenuItem | ( | Object | sender, |
MenuItem | item, | ||
Object | newValue | ||
) |
Update the value for the given menu item. This updates the state in the underlying tree and sends notifications locally and remote
item | the item that has changed |
newValue | the new value |
|
static |