Class NodeEditor
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.inductiveautomation.ignition.client.jsonedit.NodeEditor
- All Implemented Interfaces:
- ImageObserver,- MenuContainer,- Serializable,- Accessible
- Direct Known Subclasses:
- PerspectiveNodeEditor
This UI does the heavy lifting for the json editor. Consists of a "main editor" which has the drag handle, the
 options menu, the collapse control, key editor, and value editor, and a collection of child editors which
 are the editors for the node's children (if any)
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionclassThe panel that is the main row of editing UI for this node (i.e.static classstatic interfaceHeads up! If you implement this, you also must be a JComponentNested classes/interfaces inherited from class javax.swing.JPanelJPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponentJComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.ContainerContainer.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.ComponentComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
- 
Field SummaryFieldsFields inherited from class javax.swing.JComponentlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.ComponentaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserverABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
- 
Constructor SummaryConstructorsConstructorDescriptionNodeEditor(JsonEditor jsonEditor, int depth, NodeEditor parentEditor, DocumentNode node) This constructor can be used for a normal node editor or a special empty version.
- 
Method SummaryModifier and TypeMethodDescriptionvoidintapplyFilter(com.jidesoft.filter.Filter<String> filter) Applies a string filter to this editor.protected voidchangeNodeType(NodeType type) voidvoidprotected KeyEditorFieldcreateKeyEditor(DocumentNode node) protected JComponentcreateValueEditor(DocumentNode node, MouseListener popupListener) Called for "value" nodes, that is, nodes that are not objects or arrays, in order to create an editor for them.final voiddestroy()Called when this UI is no longer used in order to remove any listeners from the underlying document node.protected StringgetAddChildText(DocumentNode parent) protected Optional<JComponent>getArrayHelper(JsonSchema schema) Called for array-typed nodes, in order to optionally create a helper component that will be added to the right of the object size indicator.com.inductiveautomation.ignition.client.jsonedit.NodeEditor.ChildEditorsintgetDepth()getNode()protected Optional<JComponent>getObjectHelper(JsonSchema schema) Called for object-typed nodes, in order to optionally create a helper component that will be added to the right of the object size indicator.protected StringgetPath()Shortcut to get the path to the node as a stringprotected voidinitContextMenu(JPopupMenu menu) Called to initialize the context menu at the very end (to add actions after the cut, copy, paste, delete, and type actions.protected voidbooleanbooleanprotected booleanWhether or not this node can be altered by the userprotected voidSubclasses may override this to do something when the editor is being destroyedprotected voidonInit()Subclasses may override this to provide custom initialization.voidsetExpanded(boolean expanded) voidExpands the node and if the key is editable, starts editing it.toString()voidvisit(Consumer<NodeEditor> visitor, boolean load) Calls the visitor for each node editor in the hierarchy.Methods inherited from class javax.swing.JPanelgetAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class javax.swing.JComponentaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class java.awt.Containeradd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Componentaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
- 
Field Details- 
GUTTER_BACKGROUND
- 
GUTTER_BORDER
 
- 
- 
Constructor Details- 
NodeEditorpublic NodeEditor(JsonEditor jsonEditor, int depth, @Nullable NodeEditor parentEditor, @Nullable DocumentNode node) This constructor can be used for a normal node editor or a special empty version. Exactly one of node _or_ message must be non-null.- Parameters:
- depth- This defines the depth of this node within the document. If the root node is given a depth of zero, then controls for the root object will be visible. If the root node is given a depth of -1, then the root node controls will be hidden (useful when the document should always be an object at the root and you don't want to give the user the ability to change the root node type)
 
 
- 
- 
Method Details- 
destroypublic final void destroy()Called when this UI is no longer used in order to remove any listeners from the underlying document node.
- 
onDestroyprotected void onDestroy()Subclasses may override this to do something when the editor is being destroyed
- 
getPathShortcut to get the path to the node as a string
- 
onInitprotected void onInit()Subclasses may override this to provide custom initialization.
- 
initContextMenuCalled to initialize the context menu at the very end (to add actions after the cut, copy, paste, delete, and type actions.
- 
initContextMenuAdditionalActions
- 
isMutableprotected boolean isMutable()Whether or not this node can be altered by the user
- 
getMainEditor
- 
getChildPanelpublic com.inductiveautomation.ignition.client.jsonedit.NodeEditor.ChildEditors getChildPanel()
- 
getParentEditor
- 
getNode
- 
toString
- 
isFullyLoadedpublic boolean isFullyLoaded()
- 
startEditingpublic void startEditing()Expands the node and if the key is editable, starts editing it.
- 
addAfterChildrenUpdateCallback
- 
getDepthpublic int getDepth()- Returns:
- the depth of this node in the hierarchy. Note that the "root" node will be at depth -1 if the node editor was configured to hide the root.
 
- 
visitCalls the visitor for each node editor in the hierarchy.
- 
applyFilterApplies a string filter to this editor. This will do a few things:1. Test the filter against this node's key and value (if applicable) 2. Highlight they key and/or value fields if they match the filter 3. Apply the filter to all children. 4. If this node or any children matched the filter, will set expanded=true - Returns:
- number of matches found
 
- 
clearFilterpublic void clearFilter()
- 
commitEditpublic void commitEdit()
- 
isExpandedpublic boolean isExpanded()
- 
setExpandedpublic void setExpanded(boolean expanded) 
- 
getAddChildText
- 
getObjectHelperCalled for object-typed nodes, in order to optionally create a helper component that will be added to the right of the object size indicator.
- 
getArrayHelperCalled for array-typed nodes, in order to optionally create a helper component that will be added to the right of the object size indicator.
- 
createValueEditorCalled for "value" nodes, that is, nodes that are not objects or arrays, in order to create an editor for them.If your editor happens to implement NodeEditor.ValueEditorComponent, you'll get additional functionality like schema and ui lifecycle support- Parameters:
- popupListener- Mouse listener to add to any interior components in order for the context menu to work correctly
- Returns:
- A component to use as the editor
 
- 
createKeyEditor
- 
changeNodeType
 
-