Lines 53-58
Link Here
|
53 |
import java.util.Set; |
53 |
import java.util.Set; |
54 |
import javax.swing.AbstractAction; |
54 |
import javax.swing.AbstractAction; |
55 |
import javax.swing.Action; |
55 |
import javax.swing.Action; |
|
|
56 |
import javax.swing.JMenu; |
56 |
import javax.swing.JPopupMenu; |
57 |
import javax.swing.JPopupMenu; |
57 |
import javax.swing.JScrollPane; |
58 |
import javax.swing.JScrollPane; |
58 |
import javax.swing.JSeparator; |
59 |
import javax.swing.JSeparator; |
Lines 72-77
Link Here
|
72 |
import org.netbeans.api.visual.action.WidgetAction; |
73 |
import org.netbeans.api.visual.action.WidgetAction; |
73 |
import org.netbeans.api.visual.anchor.AnchorFactory; |
74 |
import org.netbeans.api.visual.anchor.AnchorFactory; |
74 |
import org.netbeans.api.visual.graph.GraphScene; |
75 |
import org.netbeans.api.visual.graph.GraphScene; |
|
|
76 |
import org.netbeans.api.visual.graph.layout.GraphLayout; |
77 |
import org.netbeans.api.visual.graph.layout.GraphLayoutFactory; |
78 |
import org.netbeans.api.visual.graph.layout.GraphLayoutSupport; |
75 |
import org.netbeans.api.visual.layout.SceneLayout; |
79 |
import org.netbeans.api.visual.layout.SceneLayout; |
76 |
import org.netbeans.api.visual.model.ObjectState; |
80 |
import org.netbeans.api.visual.model.ObjectState; |
77 |
import org.netbeans.api.visual.widget.ConnectionWidget; |
81 |
import org.netbeans.api.visual.widget.ConnectionWidget; |
Lines 126-131
Link Here
|
126 |
|
130 |
|
127 |
private static Set<ArtifactGraphNode> EMPTY_SELECTION = new HashSet<ArtifactGraphNode>(); |
131 |
private static Set<ArtifactGraphNode> EMPTY_SELECTION = new HashSet<ArtifactGraphNode>(); |
128 |
private POMModel model; |
132 |
private POMModel model; |
|
|
133 |
private JScrollPane pane; |
129 |
|
134 |
|
130 |
/** Creates a new instance ofla DependencyGraphScene */ |
135 |
/** Creates a new instance ofla DependencyGraphScene */ |
131 |
DependencyGraphScene(MavenProject prj, Project nbProj, DependencyGraphTopComponent tc, |
136 |
DependencyGraphScene(MavenProject prj, Project nbProj, DependencyGraphTopComponent tc, |
Lines 148-157
Link Here
|
148 |
} |
153 |
} |
149 |
|
154 |
|
150 |
|
155 |
|
151 |
void cleanLayout(JScrollPane panel) { |
156 |
void cleanLayout() { |
152 |
// GraphLayout layout = GraphLayoutFactory.createHierarchicalGraphLayout(this, true, false); |
157 |
//start using default layout |
153 |
// layout.layoutGraph(this); |
158 |
layout = new FruchtermanReingoldLayout(this, pane); |
154 |
layout = new FruchtermanReingoldLayout(this, panel); |
|
|
155 |
layout.invokeLayout(); |
159 |
layout.invokeLayout(); |
156 |
} |
160 |
} |
157 |
|
161 |
|
Lines 309-314
Link Here
|
309 |
} |
313 |
} |
310 |
} |
314 |
} |
311 |
|
315 |
|
|
|
316 |
void setSurroundingScrollPane(JScrollPane pane) { |
317 |
this.pane=pane; |
318 |
} |
312 |
|
319 |
|
313 |
|
320 |
|
314 |
private class AllActionsProvider implements PopupMenuProvider, |
321 |
private class AllActionsProvider implements PopupMenuProvider, |
Lines 332-342
Link Here
|
332 |
} |
339 |
} |
333 |
}*/ |
340 |
}*/ |
334 |
|
341 |
|
335 |
@Messages("ACT_Show_Graph=Show Dependency Graph") |
342 |
@Messages({ |
|
|
343 |
"ACT_Show_Graph=Show Dependency Graph", |
344 |
"ACT_LayoutSubMenu=Layout" |
345 |
}) |
336 |
@Override public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { |
346 |
@Override public JPopupMenu getPopupMenu(Widget widget, Point localLocation) { |
337 |
JPopupMenu popupMenu = new JPopupMenu(); |
347 |
JPopupMenu popupMenu = new JPopupMenu(); |
338 |
if (widget == DependencyGraphScene.this) { |
348 |
if (widget == DependencyGraphScene.this) { |
339 |
popupMenu.add(sceneZoomToFitAction); |
349 |
popupMenu.add(sceneZoomToFitAction); |
|
|
350 |
final JMenu layoutMenu = new JMenu(Bundle.ACT_LayoutSubMenu()); |
351 |
popupMenu.add(layoutMenu); |
352 |
layoutMenu.add(new FruchtermanReingoldLayoutAction()); |
353 |
layoutMenu.add(new JSeparator()); |
354 |
layoutMenu.add(new HierarchicalGraphLayoutAction()); |
355 |
layoutMenu.add(new TreeGraphLayoutVerticalAction()); |
356 |
layoutMenu.add(new TreeGraphLayoutHorizontalAction()); |
340 |
} else { |
357 |
} else { |
341 |
ArtifactGraphNode node = (ArtifactGraphNode)findObject(widget); |
358 |
ArtifactGraphNode node = (ArtifactGraphNode)findObject(widget); |
342 |
if (isEditable()) { |
359 |
if (isEditable()) { |
Lines 496-501
Link Here
|
496 |
} |
513 |
} |
497 |
}; |
514 |
}; |
498 |
|
515 |
|
|
|
516 |
private class HierarchicalGraphLayoutAction extends AbstractAction { |
517 |
|
518 |
@Messages("ACT_Layout_HierarchicalGraphLayout=Hierarchical") |
519 |
HierarchicalGraphLayoutAction() { |
520 |
putValue(NAME, ACT_Layout_HierarchicalGraphLayout()); |
521 |
} |
522 |
|
523 |
@Override public void actionPerformed(ActionEvent e) { |
524 |
GraphLayout layout =GraphLayoutFactory.createHierarchicalGraphLayout(DependencyGraphScene.this, true, false); |
525 |
layout.layoutGraph(DependencyGraphScene.this); |
526 |
} |
527 |
}; |
528 |
private class TreeGraphLayoutVerticalAction extends AbstractAction { |
529 |
|
530 |
@Messages("ACT_Layout_TreeGraphLayoutVertical=Vertical Tree") |
531 |
TreeGraphLayoutVerticalAction() { |
532 |
putValue(NAME, ACT_Layout_TreeGraphLayoutVertical()); |
533 |
} |
534 |
|
535 |
@Override public void actionPerformed(ActionEvent e) { |
536 |
GraphLayout layout = GraphLayoutFactory.createTreeGraphLayout(10, 10, 50, 50, true); |
537 |
GraphLayoutSupport.setTreeGraphLayoutRootNode(layout, DependencyGraphScene.this.rootNode); |
538 |
|
539 |
layout.layoutGraph(DependencyGraphScene.this); |
540 |
} |
541 |
}; |
542 |
|
543 |
|
544 |
private class TreeGraphLayoutHorizontalAction extends AbstractAction { |
545 |
|
546 |
@Messages("ACT_Layout_TreeGraphLayoutHorizontal=Horizontal Tree") |
547 |
TreeGraphLayoutHorizontalAction() { |
548 |
putValue(NAME, ACT_Layout_TreeGraphLayoutHorizontal()); |
549 |
} |
550 |
|
551 |
@Override public void actionPerformed(ActionEvent e) { |
552 |
GraphLayout layout = GraphLayoutFactory.createTreeGraphLayout(10, 10, 50, 50, false); |
553 |
GraphLayoutSupport.setTreeGraphLayoutRootNode(layout, DependencyGraphScene.this.rootNode); |
554 |
|
555 |
layout.layoutGraph(DependencyGraphScene.this); |
556 |
} |
557 |
}; |
558 |
private class FruchtermanReingoldLayoutAction extends AbstractAction { |
559 |
|
560 |
@Messages("ACT_Layout_FruchtermanReingoldLayout=Default Layout") |
561 |
FruchtermanReingoldLayoutAction() { |
562 |
putValue(NAME, ACT_Layout_FruchtermanReingoldLayout()); |
563 |
} |
564 |
|
565 |
@Override public void actionPerformed(ActionEvent e) { |
566 |
//default layout in 7.3 |
567 |
layout = new FruchtermanReingoldLayout(DependencyGraphScene.this, pane); |
568 |
layout.invokeLayout(); |
569 |
} |
570 |
}; |
571 |
|
499 |
private class HighlightedZoomToFitAction extends AbstractAction { |
572 |
private class HighlightedZoomToFitAction extends AbstractAction { |
500 |
|
573 |
|
501 |
HighlightedZoomToFitAction() { |
574 |
HighlightedZoomToFitAction() { |