java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.inductiveautomation.ignition.client.jsonedit.JsonEditor
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
ComponentScopeEditor

public class JsonEditor extends JPanel
Created by carlg on 5/15/2017.
See Also:
  • Field Details

    • SCROLL_UNIT_INCREMENT

      public static final int SCROLL_UNIT_INCREMENT
      See Also:
    • SCROLL_BLOCK_INCREMENT

      public static final int SCROLL_BLOCK_INCREMENT
      See Also:
    • model

      protected DocumentModel model
    • COLLAPSED

      public static final Icon COLLAPSED
    • EXPANDED

      public static final Icon EXPANDED
  • Constructor Details

    • JsonEditor

      public JsonEditor(String json, boolean showRoot)
    • JsonEditor

      public JsonEditor(DocumentModel model, boolean showRoot)
  • Method Details

    • findEditorFor

      public Optional<NodeEditor> findEditorFor(JsonPath path)
    • setModel

      public void setModel(DocumentModel model)
      Sets the model for this editor
    • newNodeEditor

      protected NodeEditor newNodeEditor(int depth, NodeEditor parent, DocumentNode node)
    • insertDefaultItem

      public boolean insertDefaultItem(DocumentNode parent, int index)
      Insert a new node on the parent representing the default value as declared in it's schema.
      Parameters:
      parent - The parent node to insert new node.
      index - The index in which to add the new node.
      Returns:
      {boolean} Returns true if a new default item node was inserted, false otherwise.
    • centerComponent

      protected final JComponent centerComponent()
    • applyFilter

      public int applyFilter(com.jidesoft.filter.Filter<String> filter)
    • clearFilter

      public void clearFilter()
    • isToolbarVisible

      protected boolean isToolbarVisible()
    • isScrollable

      protected boolean isScrollable()
    • getModel

      public DocumentModel getModel()
    • expandAll

      public void expandAll()
    • collapseAll

      public void collapseAll()
    • commitEdit

      public void commitEdit()
    • getJsonElement

      public com.inductiveautomation.ignition.common.gson.JsonElement getJsonElement()
      Get the current state of the edited model as a gson object
    • getJson

      public String getJson()
      Get the current state of the edited model as a json document
    • getJson

      public String getJson(boolean prettyPrint)
    • insertNewNode

      protected void insertNewNode(DocumentNode parent, DocumentNode newNode, int insertionPoint)
    • configureInsertMenu

      protected void configureInsertMenu(MenuLike menu, DocumentNode parent, int insertPt)
    • newValueValue

      protected Object newValueValue()
      The actual value to use for new "Value" nodes.
    • main

      public static void main(String[] args)