wGmdh.jGmdh.gui
Class GuiManager

java.lang.Object
  extended by wGmdh.jGmdh.gui.GuiManager

public class GuiManager
extends java.lang.Object

GMDH network visualization. Nodes are represented by JComponents, while their links are only drawn on the JPanel. 3 additional worker threads are used, one for highlighting and unhighlighting a node when mouse pointer enters the region of the node, one that arms and disarms a node and one used when a node is dragged to find its parents and children Note: no generic solutions are provided to i.e. zooming and connecting Nodes; problems were solved as they came. Also there is no abstracion to implement to get a graphical representation of GMDH. Make your own from scrap.


Nested Class Summary
protected  class GuiManager.SimulatedAnnealingRelocation
           
protected  class GuiManager.ZoomableLinks
          Zooming stuffz
 class GuiManager.ZoomSlider
           
 
Field Summary
protected  java.util.List<NodeGraphics> armedNodes
           
protected  java.lang.Object armLock
           
 int borderX
           
 int borderY
           
protected  javax.swing.JPanel controlPanel
           
protected  int currentlyDisplayed
           
protected  javax.swing.JButton cycleButton
           
protected  java.lang.Object dragLock
           
protected  javax.swing.JFrame frame
           
 int height
           
protected  javax.swing.JEditorPane infoArea
           
protected  javax.swing.JEditorPane infoArea2
           
protected  javax.swing.JPanel infoButtonPanel
           
protected  javax.swing.JPanel infoPanel
           
protected  javax.swing.JScrollPane infoScrollPane
           
protected  javax.swing.JScrollPane infoScrollPane2
           
protected  javax.swing.JEditorPane instructionArea
           
protected  javax.swing.JScrollPane instructionScrollPane
           
 java.util.ArrayList<java.util.ArrayList<? extends Node>> layers
           
protected  java.lang.Object mouseOverLock
           
protected  javax.swing.JButton namespaceButton
           
protected  java.util.List<NodeGraphics> nodesToArm
           
protected  java.util.List<NodeGraphics> nodesToUnarm
           
protected  GuiManager.ZoomableLinks overlay
           
protected  NodebuttonPanel panel
           
 int recursionCount
          Preorder traversal.
protected  SubpixelScrollPane scrollPane
           
protected  javax.swing.JLabel sliderLabel
           
protected  javax.swing.JButton snapToGridJB
           
protected  javax.swing.JButton sortByErrorJB
           
 java.util.ArrayList<java.util.ArrayList<NodeGraphics>> visible
           
 int width
           
protected  java.lang.Object zoomIsDirtyLock
           
protected  GuiManager.ZoomSlider zoomSlider
           
 
Constructor Summary
GuiManager(java.util.ArrayList<java.util.ArrayList<? extends Node>> layers, int x, int y, int borderX, int borderY)
           
GuiManager(int x, int y, int borderX, int borderY)
           
 
Method Summary
protected  void drawLinksWhenDragged(NodeGraphics dragged)
          When dragging is through, this method is used to superpose direct links of dragged node onto the armed buffer.
protected  void executeAfterdragRunnable()
           
protected  void executeArmingTask()
           
protected  void executeDraggedRunnable()
           
protected  void executeHighlightRunnable(NodeGraphics ng)
           
protected  void executeRelinkHighlightedRunnable()
           
protected  void executeUnhighlightRunnable()
           
protected  void executeUnhiglightRunnableAndWait()
           
 void fullRepaint()
           
 java.util.concurrent.ExecutorService getArmingExecutor()
           
 org.pbjar.jxlayer.plaf.ext.transform.DefaultTransformModel getDefaultTransformModel()
           
 java.util.concurrent.ExecutorService getFirstDragExecutor()
           
 java.util.concurrent.ExecutorService getHighlightingExecutor()
           
 java.awt.Dimension getLastRedrawnDimension()
           
 GuiManager.ZoomableLinks getOverlay()
           
protected  void initializeModelGraphics(Model model)
           
 void launchGUI(java.util.List<Model> modelsToAdd)
          Sets everything up for display: initializes and displays the layer of attributes and all models listed in modelsToAdd
 void onFrameClosing()
           
protected  java.awt.Graphics2D redrawNative(boolean repaints)
           
protected  void representAllModels()
          Iterates through layers, initializes their NodeGraphics and adds them to JPanel.
protected  void representAttributes()
           
protected  void representModels(java.util.List<? extends Model> toDraw)
           
 void SnapToGrid()
           
 void SortByError()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

height

public int height

width

public int width

borderX

public int borderX

borderY

public int borderY

layers

public java.util.ArrayList<java.util.ArrayList<? extends Node>> layers

visible

public java.util.ArrayList<java.util.ArrayList<NodeGraphics>> visible

frame

protected javax.swing.JFrame frame

panel

protected final NodebuttonPanel panel

scrollPane

protected SubpixelScrollPane scrollPane

snapToGridJB

protected javax.swing.JButton snapToGridJB

sortByErrorJB

protected javax.swing.JButton sortByErrorJB

armedNodes

protected java.util.List<NodeGraphics> armedNodes

nodesToArm

protected java.util.List<NodeGraphics> nodesToArm

nodesToUnarm

protected java.util.List<NodeGraphics> nodesToUnarm

currentlyDisplayed

protected int currentlyDisplayed

armLock

protected final java.lang.Object armLock

mouseOverLock

protected final java.lang.Object mouseOverLock

dragLock

protected final java.lang.Object dragLock

zoomIsDirtyLock

protected final java.lang.Object zoomIsDirtyLock

sliderLabel

protected javax.swing.JLabel sliderLabel

zoomSlider

protected GuiManager.ZoomSlider zoomSlider

controlPanel

protected javax.swing.JPanel controlPanel

infoPanel

protected javax.swing.JPanel infoPanel

infoButtonPanel

protected javax.swing.JPanel infoButtonPanel

infoArea

protected javax.swing.JEditorPane infoArea

instructionArea

protected javax.swing.JEditorPane instructionArea

instructionScrollPane

protected javax.swing.JScrollPane instructionScrollPane

infoScrollPane

protected javax.swing.JScrollPane infoScrollPane

infoArea2

protected javax.swing.JEditorPane infoArea2

infoScrollPane2

protected javax.swing.JScrollPane infoScrollPane2

cycleButton

protected javax.swing.JButton cycleButton

namespaceButton

protected javax.swing.JButton namespaceButton

recursionCount

public int recursionCount
Preorder traversal. On visit initialize NodeGraphics, if not initialized. Recursion is not the smartest thing to do here. It can be very deep so it can take alot of stack space, especially with the not so small objects used.


overlay

protected GuiManager.ZoomableLinks overlay
Constructor Detail

GuiManager

public GuiManager(java.util.ArrayList<java.util.ArrayList<? extends Node>> layers,
                  int x,
                  int y,
                  int borderX,
                  int borderY)

GuiManager

public GuiManager(int x,
                  int y,
                  int borderX,
                  int borderY)
Method Detail

fullRepaint

public void fullRepaint()

getHighlightingExecutor

public java.util.concurrent.ExecutorService getHighlightingExecutor()

getArmingExecutor

public java.util.concurrent.ExecutorService getArmingExecutor()

getFirstDragExecutor

public java.util.concurrent.ExecutorService getFirstDragExecutor()

getLastRedrawnDimension

public java.awt.Dimension getLastRedrawnDimension()

getDefaultTransformModel

public org.pbjar.jxlayer.plaf.ext.transform.DefaultTransformModel getDefaultTransformModel()

representAllModels

protected void representAllModels()
Iterates through layers, initializes their NodeGraphics and adds them to JPanel.


representAttributes

protected void representAttributes()

representModels

protected void representModels(java.util.List<? extends Model> toDraw)

initializeModelGraphics

protected void initializeModelGraphics(Model model)

SnapToGrid

public void SnapToGrid()

SortByError

public void SortByError()

getOverlay

public GuiManager.ZoomableLinks getOverlay()

redrawNative

protected java.awt.Graphics2D redrawNative(boolean repaints)

onFrameClosing

public void onFrameClosing()

launchGUI

public void launchGUI(java.util.List<Model> modelsToAdd)
Sets everything up for display: initializes and displays the layer of attributes and all models listed in modelsToAdd

Parameters:
modelsToAdd - if zero, displays all models listed in this.layers

executeAfterdragRunnable

protected void executeAfterdragRunnable()

executeHighlightRunnable

protected void executeHighlightRunnable(NodeGraphics ng)

executeRelinkHighlightedRunnable

protected void executeRelinkHighlightedRunnable()

executeUnhighlightRunnable

protected void executeUnhighlightRunnable()

executeArmingTask

protected void executeArmingTask()

executeUnhiglightRunnableAndWait

protected void executeUnhiglightRunnableAndWait()

executeDraggedRunnable

protected void executeDraggedRunnable()

drawLinksWhenDragged

protected void drawLinksWhenDragged(NodeGraphics dragged)
When dragging is through, this method is used to superpose direct links of dragged node onto the armed buffer. The rest of the links will not get drawn on the buffer. Works properly only if the zoomable overlay's armed buffer has resolution optimized with regard to its size. Make sure to call it from a block synchronized with dragLock

Parameters:
dragged -