Class JavaJsBridge
java.lang.Object
com.inductiveautomation.perspective.designer.workspace.JavaJsBridge
- Direct Known Subclasses:
- SessionPropsAdapter.SessionAdapterBridge,- ViewEditorJsBridge
This class acts as a 'bridge' between the Java and Javascript environments.  It is instantiated and embedded into the
 js environment through JxBrowser's Java accessibility API.  Calls which are made FROM javascript are annotated with
 
JsAccessible.
 We must manually shut down this bridge to prevent memory leaks.  See shutdown().- Since:
- 8.0.0
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionJavaJsBridge(com.teamdev.jxbrowser.browser.Browser browser, DesignerContext context) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidactivateComponentTool(String componentType) voidactivateComponentTool(String componentType, String variantId) voidaddComponents(List<ComponentConfig> componentConfigs, Point point) Add components to the current deeply selected container, specifying the locationvoidaddComponents(List<ComponentConfig> componentConfigs, Rectangle location) Add components to the current deeply selected container, specifying location and sizevoidaddComponentsToContainer(String parentIndexPath, List<ComponentConfig> componentConfigs, Rectangle location, int[] childrenIndexes, boolean createUndoAction) Add components to a specific container, even if it isn't deeply selected.voidvoidalterEventConfig(EventConfigChange change) voidalterPropertyConfig(PropertyConfigChange change, boolean createUndoAction) voidalterScriptConfig(ScriptConfigChange change) abstract voidalterViewPermissions(PermissionsConfig permissionsConfig) voidvoidconvertPipesToDrawing(String path) voidvoidvoidvoiddeleteComponents(String[] indexPaths, boolean createUndoAction) Deletes the components at the given index pathsvoidDeletes the components currently selected in the designer store.voidDeletes the selected PipevoidDeletes the selected PipevoidvoidvoidvoidflattenSvg(String svg, String position, String name) protected abstract StringgetChildPositionDefaults(String componentType, boolean forInit) getComponentBaseName(String componentType) getComponentDetails(String componentIndexPath) protected abstract DesignerContext<T> CompletableFuture<T>getForSave(BiFunction<String, com.inductiveautomation.ignition.common.gson.Gson, T> parse) Retrieves the view config from the running View instance in the DesignerViewInstanceStore.Gets the info needed to open a new view for editing.Gets the current view configuration from the Designer Project.Called to get the current name of the project resource associated with a view's tabId.getPropertyDefaults(String propertyType, String componentType, String variantId, boolean forInit) Returns a json object containing the default properties registered in the component registry.protected abstract SessionPropsConfiggetSymbolicPath(String indexPath) getSymbolStyles(String theme) getViewConfig(String resourcePath) protected abstract ViewConfigprotected abstract ViewConfiggetViewConfigInternal(String resourcePath) protected abstract Stringabstract CompletableFuture<PermissionsConfig>voidinsertProperty(InsertPropertyChange change) protected CompletableFuture<JxValue>invokeStoreFunction(String functionName, Object... args) Invokes a method on the DesignerStore.tsx object.voidnotifyViewUpdated(String path) voidonBindingPreviewValue(String serializedMessage) Called from a DesignerStore handler upon receiving the 'binding-edit-value-update' message.protected abstract voidvoidonContextMenu(String pointJson, boolean canConvertToDrawing, boolean isDrawing, boolean isSvg, boolean isView) protected abstract voidonContextMenuInternal(Point point, boolean canConvertToDrawing, boolean isDrawing, boolean isSvg, boolean isView) voidonConvertToDrawing(String path, String name, String position, String svgSource, boolean pipeMode) voidonDeepSelectionChange(String json) protected abstract voidonDeepSelectionChangeInternal(DeepSelection deepSelection, com.teamdev.jxbrowser.js.JsObject storeObject) voidprotected abstract voidvoidonErrorMessage(String message) voidonImageDropped(String imageSource, String dropPoint) voidonPipeModeChange(String pipeMode) Called when the pipe mode changes.protected abstract voidonPipeModeChangeInternal(String pipeMode) voidonPipeSelectionChange(String pipeSelection, boolean replaceComponentSelection) Called when the pipe selection changes.protected abstract voidonPipeSelectionChangeInternal(List<PipeSelectionDetail> details, boolean replaceComponentSelection) voidonSaveComplete(String json) Called from a DesignerStore once the data to save has been gathered via PromisevoidonSaveError(String reason) Called from a DesignerStore if there was an error gathering the data to savevoidonSelectionChange(String rootViewPath, String detailsJson) Called when the selection changes.protected abstract voidonSelectionChangeInternal(String rootViewPath, List<ComponentDetails> details) voidonSelectionConfigUpdated(String changesJson) Called when one of the currently selected components config changes (bindings or event config)protected abstract voidvoidonSelectionPropertyChange(String rootViewPath, String changesJson) Called when one of the currently selected components' properties changesprotected abstract voidvoidonStructureChange(String structureJson) protected abstract voidonStructureChangeInternal(ViewStructure structure) voidonSvgDropped(String name, String svgSource, String dropPoint) voidonTagsDropped(String path, String tagsJson, String dropPointJson, String modifiers) voidonUndoableAction(String key, String json) voidvoidpastePipes(List<PipeConfig> pipe, Point point) Add pipes to the current deeply selected containervoidvoidremoveChildPropertyConfigs(String componentIndexPath, PropertyType scope, String propertyPath) voidremoveProperty(RemovePropertyChange change, boolean createUndoAction) voidrenameProperty(RenamePropertyChange change, boolean createUndoAction) voidvoidreplaceComponent(String path, ComponentConfig component, boolean replaceAtLocation, boolean createUndoAction) Replaces the component at the specified path with the specified ComponentConfig.voidreplaceComponentFromClipboard(String path, String clipboardContents) Sends a message through the websocket held by the connection store.voidvoidsetDeepSelection(String path) voidsetPipeMode(String pipeMode) PipingvoidsetPipeSelection(List<PipeSelectionDetail> details) voidsetPreview(boolean preview) voidsetSelection(List<String> selection) voidshutdown()Must be called by the parent panel when it initiates shutdown.voidstylesUpdated(String styles) voidwrapComponent(String path, ViewWorkspaceActions.WrapInType type) Wraps a component at the specified Path with a specified Type of component.voidwriteProperties(WritePropertiesChange change) voidwriteProperty(WritePropertyChange change, boolean createUndoAction) 
- 
Field Details- 
log
- 
gsonprotected final com.inductiveautomation.ignition.common.gson.Gson gson
 
- 
- 
Constructor Details- 
JavaJsBridge
 
- 
- 
Method Details- 
getBridgeDesc
- 
getForSavepublic <T> CompletableFuture<T> getForSave(BiFunction<String, com.inductiveautomation.ignition.common.gson.Gson, T> parse) Retrieves the view config from the running View instance in the DesignerViewInstanceStore.
- 
onSaveCompleteCalled from a DesignerStore once the data to save has been gathered via Promise- Parameters:
- json- JSON stringified view data or session props data
 
- 
onSaveErrorCalled from a DesignerStore if there was an error gathering the data to save- Parameters:
- reason- the reason why there was an error
 
- 
getOwnViewPathCalled to get the current name of the project resource associated with a view's tabId. Derives from the designer project.- Returns:
- string representation of this View's path in the project resource.
 
- 
getViewPathInternal
- 
getOwnViewConfigGets the current view configuration from the Designer Project. Used as the view definition in the designer's instance store.- Returns:
- the view config from the designer as a ViewConfig
 
- 
getViewConfigInternal
- 
getContextInternal
- 
getSessionProps
- 
getSessionPropsInternal
- 
getInitMsgGets the info needed to open a new view for editing.
- 
getPropertyDefaultspublic String getPropertyDefaults(String propertyType, String componentType, String variantId, boolean forInit) Returns a json object containing the default properties registered in the component registry. If forInit is true, default props will include example values when found in the registered component descriptors example props.
- 
getChildPositionDefaults
- 
getComponentBaseName
- 
onStructureChange
- 
onStructureChangeInternal
- 
activateComponentTool
- 
activateComponentTool
- 
invokeStoreFunctionInvokes a method on the DesignerStore.tsx object.
- 
notifyViewUpdated
- 
sendRawSends a message through the websocket held by the connection store.
- 
getComponentDetails
- 
getEffectivePipeSelectionAppearance
- 
setChildrenIndexes
- 
writeProperty
- 
writeProperties
- 
insertProperty
- 
renameProperty
- 
removeProperty
- 
alterPropertyConfig
- 
alterEventConfig
- 
alterScriptConfig
- 
removeChildPropertyConfigspublic void removeChildPropertyConfigs(String componentIndexPath, PropertyType scope, String propertyPath) 
- 
alterViewPermissions
- 
getViewPermissions
- 
onBindingPreviewValueCalled from a DesignerStore handler upon receiving the 'binding-edit-value-update' message.- Parameters:
- serializedMessage- Base64 serialized object from the gateway
 
- 
onBindingPreviewValueInternal
- 
onDeepSelectionChange
- 
onDeepSelectionChangeInternalprotected abstract void onDeepSelectionChangeInternal(DeepSelection deepSelection, com.teamdev.jxbrowser.js.JsObject storeObject) 
- 
onDeepSelectionPropsUpdated
- 
onDeepSelectionPropsUpdatedInternal
- 
onSelectionChangeCalled when the selection changes.- Parameters:
- detailsJson- List<ComponentDetails> encoded in JSON
 
- 
onSelectionChangeInternalprotected abstract void onSelectionChangeInternal(String rootViewPath, List<ComponentDetails> details) 
- 
onSelectionPropertyChangeCalled when one of the currently selected components' properties changes
- 
onSelectionPropertyChangeInternal
- 
onSelectionConfigUpdatedCalled when one of the currently selected components config changes (bindings or event config)
- 
onSelectionConfigUpdatedInternal
- 
onContextMenupublic void onContextMenu(String pointJson, boolean canConvertToDrawing, boolean isDrawing, boolean isSvg, boolean isView) 
- 
onContextMenuInternalprotected abstract void onContextMenuInternal(Point point, boolean canConvertToDrawing, boolean isDrawing, boolean isSvg, boolean isView) 
- 
onImageDropped
- 
onConvertToDrawing
- 
onSvgDropped
- 
onTagsDropped
- 
onUndoableAction
- 
onErrorMessage
- 
flattenSvg
- 
setSelection
- 
setDeepSelection
- 
deleteSelectedpublic void deleteSelected()Deletes the components currently selected in the designer store.
- 
deleteComponentsDeletes the components at the given index paths
- 
convertComponentToDrawing
- 
convertPipesToDrawing
- 
convertSelectionToDrawingpublic void convertSelectionToDrawing()
- 
flattenSelectedSvgpublic void flattenSelectedSvg()
- 
alignSelectedComponentspublic void alignSelectedComponents(CoordinateContainerDesignDelegate.AlignType type, Integer padding) 
- 
reorderSelectedComponents
- 
replaceComponentpublic void replaceComponent(String path, ComponentConfig component, boolean replaceAtLocation, boolean createUndoAction) Replaces the component at the specified path with the specified ComponentConfig. Used to make undo-redo easy for wrapComponent.- Parameters:
- path- The addressPathString of the Component to be replaced.
- component- The componentConfig to replace the Component with
- replaceAtLocation- Determines if replacement should occur at the component to be replaced
 
- 
replaceComponentFromClipboard
- 
wrapComponentWraps a component at the specified Path with a specified Type of component. WrapInType is not a component id, nor is there a 1:1 between the two. For example: Flex Containers have both flex_row, and flex_column.- Parameters:
- path- The addressPathString of the Component to be wrapped. If null, the currently selected Component will be wrapped.
- type- The WrapInType to use to determine the strategy used for wrapping the Component.
 
- 
addComponentsToContainerpublic void addComponentsToContainer(String parentIndexPath, List<ComponentConfig> componentConfigs, @Nullable Rectangle location, @Nullable int[] childrenIndexes, boolean createUndoAction) Add components to a specific container, even if it isn't deeply selected.
- 
addComponentsAdd components to the current deeply selected container, specifying the location
- 
addComponentsAdd components to the current deeply selected container, specifying location and size
- 
copySelection
- 
disableEditorEventspublic void disableEditorEvents()
- 
enableEditorEventspublic void enableEditorEvents()
- 
copyJsonToClipboardpublic void copyJsonToClipboard()
- 
pasteJsonFromClipboardpublic void pasteJsonFromClipboard()
- 
cutJsonToClipboardpublic void cutJsonToClipboard()
- 
getViewConfig- Returns:
- a ViewConfig's json string equivalent for a view found at the given path.
 
- 
getViewConfigInternal
- 
setPreviewpublic void setPreview(boolean preview) 
- 
getSymbolicPath
- 
stylesUpdated
- 
reloadSymbolStylespublic void reloadSymbolStyles()
- 
getStyles
- 
getSymbolStyles
- 
setPipeModePiping
- 
onPipeModeChangeCalled when the pipe mode changes.
- 
onPipeModeChangeInternal
- 
setPipeSelection
- 
onPipeSelectionChangeCalled when the pipe selection changes.
- 
onPipeSelectionChangeInternalprotected abstract void onPipeSelectionChangeInternal(List<PipeSelectionDetail> details, boolean replaceComponentSelection) 
- 
copySelectedPipe
- 
pastePipesAdd pipes to the current deeply selected container
- 
deleteSelectedPipespublic void deleteSelectedPipes()Deletes the selected Pipe
- 
deleteSelectedPipeConnectionpublic void deleteSelectedPipeConnection()Deletes the selected Pipe
- 
shutdownpublic void shutdown()Must be called by the parent panel when it initiates shutdown.
 
-