Class IntrospectorView

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class IntrospectorView extends JFrame
This is the window view to visualize the program as a tree. The model representing the tree should be passed to the constructor as a parameter.
See Also:
  • Field Details

    • trees

      private final List<JTree> trees
      The tree view
    • popupMenu

      JPopupMenu popupMenu
      Popup menu used over the JTree
    • labelStatus

      JLabel labelStatus
      The label that shows the status of the application (where messages are shown)
    • DEFAULT_WINDOW_WIDTH

      private static final int DEFAULT_WINDOW_WIDTH
      In pixels, the default size of the window.
      See Also:
    • DEFAULT_WINDOW_HEIGHT

      private static final int DEFAULT_WINDOW_HEIGHT
      In pixels, the default size of the window.
      See Also:
    • horizontalSplitPanes

      private List<JSplitPane> horizontalSplitPanes
      List of horizontal split panes in the view. Their height should be modified every time a new tree is added.
  • Constructor Details

    • IntrospectorView

      public IntrospectorView(String title, TreeModel model, int width, int height, boolean show)
      Main constructor of the view
      Parameters:
      title - title of the window
      model - model to be displayed as a tree
      width - window width
      height - window height
      show - whether the window must be showed or not
    • IntrospectorView

      public IntrospectorView(String title, TreeModel model)
      A tree window is created and displayed: default size and visible
      Parameters:
      title - the title of the window
      model - the model to be shown as a tree
    • IntrospectorView

      public IntrospectorView(String title, String treeName, Object model)
      A tree window is created and displayed: default size and visible
      Parameters:
      title - the title of the window
      treeName - the name of the tree
      model - the model to be shown as a tree
    • IntrospectorView

      public IntrospectorView(String title, TreeModel model, boolean show)
      A tree window is created: default size
      Parameters:
      title - the title of the window
      model - the model to be shown as a tree
      show - whether the window must be shown
    • IntrospectorView

      public IntrospectorView(String title, String treeName, Object model, boolean show)
      A tree window is created: default size
      Parameters:
      title - the title of the window
      treeName - the name of the tree
      model - the model to be shown as a tree
      show - whether the window must be shown
    • IntrospectorView

      public IntrospectorView(String title, String treeName, Object model, int width, int height, boolean show)
      A tree window is created
      Parameters:
      title - the title of the window
      treeName - the name of the tree
      model - the model to be shown as a tree
      width - the width of the window
      height - the height of the window
      show - whether the window must be shown
  • Method Details

    • createToolBar

      private JToolBar createToolBar()
      Creates the toolbar
      Returns:
      The toolbar created
    • createPopUpMenu

      private JPopupMenu createPopUpMenu(JTree tree)
      Creates the popup menu
      Parameters:
      tree - the tree where the popup menu will be shown
      Returns:
      The popup menu created
    • createStatusBar

      private IntrospectorView.PanelAndLabel createStatusBar()
      Creates a status bar and a label inside it.
      Returns:
      the panel and label created as a status bar.
    • addTree

      public void addTree(TreeModel newTreeModel)
      Adds another tree to the window in a new horizontal split view. The new tree will be displayed below the existing tree structure.
      Parameters:
      newTreeModel - The TreeModel for the new tree to be added.
    • addTree

      public void addTree(String treeName, Object newTreeModel)
      Adds another tree to the window in a new horizontal split view. The new tree will be displayed below the existing tree structure.
      Parameters:
      treeName - The name of the new tree to be added.
      newTreeModel - The TreeModel for the new tree to be added.
    • updateVerticalSplitPanes

      public void updateVerticalSplitPanes()
      Updates the vertical split panes to be in position relative to the size of the window and the number of trees.
    • getTrees

      public List<JTree> getTrees()
      Returns the list of JTrees in the view.
      Returns:
      the JTree in the view
    • setUIFont

      private void setUIFont(Font font)
      Sets the font of the UI
      Parameters:
      font - the font to be set