Beispiel #1
0
def createSearchPanel(vis):
    searchPanel = JSearchPanel(vis, 'tree.nodes', Visualization.SEARCH_ITEMS, ['search_string'], 1, 1)
    searchPanel.setShowResultCount(1)
    searchPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 4, 0))
    searchPanel.setFont(FontLib.getFont('Tahoma', Font.PLAIN, 11))
    searchPanel.setBackground(Color.WHITE)
    searchPanel.setForeground(Color.BLACK)
    searchPanel.setLabelText(None)
    return searchPanel
Beispiel #2
0
def createTitleWidget():
    title = JFastLabel('     ')
    title.setPreferredSize(Dimension(350, 20))
    title.setVerticalAlignment(SwingConstants.BOTTOM)
    title.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0))
    title.setFont(FontLib.getFont('Tahoma', Font.PLAIN, 16))
    title.setBackground(Color.WHITE)
    title.setForeground(Color.BLACK)
    return title
Beispiel #3
0
def createListWidget():
    w =  JList()
    w.setFont(FontLib.getFont('Tahoma', 10))
    return w
Beispiel #4
0
def createVisualization(tree):
    vis = Visualization()
    vis.add('tree', tree)
    
    labelRenderer = LabelRenderer('title')
    labelRenderer.setRenderType(AbstractShapeRenderer.RENDER_TYPE_DRAW_AND_FILL)
    labelRenderer.setHorizontalAlignment(Constants.LEFT)
    labelRenderer.setRoundedCorner(8, 8)
    labelRenderer.setVerticalPadding(1)
    labelRenderer.setHorizontalPadding(4)
    edgeRenderer = EdgeRenderer()    
    edgeRenderer = EdgeRenderer(Constants.EDGE_TYPE_CURVE)

    edgeRenderer.setHorizontalAlignment1(Constants.RIGHT)
    edgeRenderer.setHorizontalAlignment2(Constants.LEFT)    
    edgeRenderer.setVerticalAlignment1(Constants.CENTER)
    edgeRenderer.setVerticalAlignment2(Constants.CENTER)        

    rendererFactory = DefaultRendererFactory(labelRenderer)
    rendererFactory.add(InGroupPredicate('tree.edges'), edgeRenderer)
    vis.setRendererFactory(rendererFactory)

    nodeFillColor = NodeFillColorAction('tree.nodes')
    nodeStrokeColor = NodeStrokeColorAction('tree.nodes')
    textColor = TextColorAction('tree.nodes')
    vis.putAction("textColor", textColor)
        
    edgeColor = ColorAction('tree.edges',
                            VisualItem.STROKECOLOR, ColorLib.rgb(200,200,200))

    vis.setInteractive('tree.edges', None, 0)
        
    repaint = ActionList()
    repaint.add(nodeFillColor)
    repaint.add(nodeStrokeColor)
    repaint.add(RepaintAction())
    vis.putAction('repaint', repaint)

    fullPaint = ActionList()
    fullPaint.add(nodeFillColor)
    fullPaint.add(nodeStrokeColor)    
    vis.putAction('fullPaint', fullPaint)

    animatePaint = ActionList(400)
    animatePaint.add(ColorAnimator('tree.nodes'))
    animatePaint.add(RepaintAction())
    vis.putAction('animatePaint', animatePaint)
    treeLayout = NodeLinkTreeLayout('tree', Constants.ORIENT_LEFT_RIGHT, 50, 2, 8)
    treeLayout.setLayoutAnchor(Point2D.Double(25, 300))
    vis.putAction('treeLayout', treeLayout)

    resize = ActionList(1000)
    z = ZoomToFitAction(vis)
    resize.add(z)
    vis.putAction('resize', resize)

    subLayout = CollapsedSubtreeLayout('tree', Constants.ORIENT_LEFT_RIGHT)
    vis.putAction('subLayout', subLayout)

    autoPan = AutoPanAction()
    filter = ActionList()
    
    fisheye = FisheyeTreeFilter('tree', 1)
    filter.add(fisheye)

    filter.add(FontAction('tree.nodes', FontLib.getFont('Tahoma', 12)))
    filter.add(nodeFillColor)
    filter.add(nodeStrokeColor)    
    filter.add(treeLayout)
    filter.add(subLayout)
    filter.add(textColor)
    filter.add(edgeColor)
    vis.putAction('filter', filter)

    animate = ActionList(500)
    animate.setPacingFunction(SlowInSlowOutPacer())
    animate.add(autoPan)
    animate.add(QualityControlAnimator())
    animate.add(VisibilityAnimator('tree'))
    animate.add(LocationAnimator('tree.nodes'))
    animate.add(ColorAnimator('tree.nodes'))
    animate.add(RepaintAction())
    vis.putAction('animate', animate)
    vis.alwaysRunAfter('filter', 'animate')
    return (vis, fisheye)