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:
- java.awt.image.ImageObserver,- java.awt.MenuContainer,- java.io.Serializable,- javax.accessibility.Accessible
 - Direct Known Subclasses:
- PerspectiveNodeEditor
 
 public class NodeEditor extends javax.swing.JPanelThis 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:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classNodeEditor.MainEditorThe panel that is the main row of editing UI for this node (i.e.static classNodeEditor.MainEditorLayoutstatic interfaceNodeEditor.ValueEditorComponentHeads up! If you implement this, you also must be a JComponent- 
Nested classes/interfaces inherited from class javax.swing.JPaneljavax.swing.JPanel.AccessibleJPanel
 - 
Nested classes/interfaces inherited from class javax.swing.JComponentjavax.swing.JComponent.AccessibleJComponent
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static java.awt.ColorGUTTER_BACKGROUNDstatic java.awt.ColorGUTTER_BORDER- 
Fields inherited from class javax.swing.JComponentlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
- 
 - 
Constructor SummaryConstructors Constructor Description NodeEditor(JsonEditor jsonEditor, int depth, NodeEditor parentEditor, DocumentNode node)This constructor can be used for a normal node editor or a special empty version.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAfterChildrenUpdateCallback(java.lang.Runnable r)intapplyFilter(com.jidesoft.filter.Filter<java.lang.String> filter)Applies a string filter to this editor.protected voidchangeNodeType(NodeType type)voidclearFilter()voidcommitEdit()protected KeyEditorFieldcreateKeyEditor(DocumentNode node)protected javax.swing.JComponentcreateValueEditor(DocumentNode node, java.awt.event.MouseListener popupListener)Called for "value" nodes, that is, nodes that are not objects or arrays, in order to create an editor for them.voiddestroy()Called when this UI is no longer used in order to remove any listeners from the underlying document node.protected java.lang.StringgetAddChildText(DocumentNode parent)protected java.util.Optional<javax.swing.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.ChildEditorsgetChildPanel()intgetDepth()NodeEditor.MainEditorgetMainEditor()DocumentNodegetNode()protected java.util.Optional<javax.swing.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.NodeEditorgetParentEditor()protected java.lang.StringgetPath()Shortcut to get the path to the node as a stringprotected voidinitContextMenu(javax.swing.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 voidinitContextMenuAdditionalActions(javax.swing.JPopupMenu menu)booleanisExpanded()booleanisFullyLoaded()protected booleanisMutable()Whether or not this node can be altered by the userprotected voidonDestroy()Subclasses may override this to do something when the editor is being destroyedprotected voidonInit()Subclasses may override this to provide custom initialization.voidsetExpanded(boolean expanded)voidstartEditing()Expands the node and if the key is editable, starts editing it.java.lang.StringtoString()voidvisit(java.util.function.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, updateUI
 - 
Methods 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, update
 - 
Methods 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, validateTree
 - 
Methods 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
 
- 
 
- 
- 
- 
Constructor Detail- 
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 Detail- 
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
 - 
getPathprotected java.lang.String getPath() Shortcut to get the path to the node as a string
 - 
onInitprotected void onInit() Subclasses may override this to provide custom initialization.
 - 
initContextMenuprotected void initContextMenu(javax.swing.JPopupMenu menu) Called to initialize the context menu at the very end (to add actions after the cut, copy, paste, delete, and type actions.
 - 
initContextMenuAdditionalActionsprotected void initContextMenuAdditionalActions(javax.swing.JPopupMenu menu) 
 - 
isMutableprotected boolean isMutable() Whether or not this node can be altered by the user
 - 
getMainEditorpublic NodeEditor.MainEditor getMainEditor() 
 - 
getChildPanelpublic com.inductiveautomation.ignition.client.jsonedit.NodeEditor.ChildEditors getChildPanel() 
 - 
getParentEditorpublic NodeEditor getParentEditor() 
 - 
getNodepublic DocumentNode getNode() 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.awt.Component
 
 - 
isFullyLoadedpublic boolean isFullyLoaded() 
 - 
startEditingpublic void startEditing() Expands the node and if the key is editable, starts editing it.
 - 
addAfterChildrenUpdateCallbackpublic void addAfterChildrenUpdateCallback(java.lang.Runnable r) 
 - 
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.
 
 - 
visitpublic void visit(java.util.function.Consumer<NodeEditor> visitor, boolean load) Calls the visitor for each node editor in the hierarchy.
 - 
applyFilterpublic int applyFilter(com.jidesoft.filter.Filter<java.lang.String> filter) Applies 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) 
 - 
getAddChildTextprotected java.lang.String getAddChildText(DocumentNode parent) 
 - 
getObjectHelperprotected java.util.Optional<javax.swing.JComponent> getObjectHelper(@Nullable 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.
 - 
getArrayHelperprotected java.util.Optional<javax.swing.JComponent> getArrayHelper(@Nullable 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.
 - 
createValueEditorprotected javax.swing.JComponent createValueEditor(DocumentNode node, java.awt.event.MouseListener popupListener) Called 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
 
 - 
createKeyEditorprotected KeyEditorField createKeyEditor(DocumentNode node) 
 - 
changeNodeTypeprotected void changeNodeType(NodeType type) 
 
- 
 
-