use of y.layout.orthogonal.OrthogonalLayouter in project binnavi by google.
the class CGraphDialogs method showGraphSettingsDialog.
/**
* Shows the graph settings dialog for a given graph.
*
* @param parent Parent window of the dialog.
* @param graph Graph whose settings are edited in the dialog.
*/
public static void showGraphSettingsDialog(final JFrame parent, final ZyGraph graph) {
final CGraphSettingsDialog dlg = new CGraphSettingsDialog(parent, "Graph Settings", graph.getSettings(), false, false);
dlg.setVisible(true);
if (!dlg.wasCanceled()) {
if (graph.getSettings().getLayoutSettings().getCurrentLayouter() instanceof CircularLayouter) {
graph.getSettings().getLayoutSettings().setDefaultGraphLayout(LayoutStyle.CIRCULAR);
} else if (graph.getSettings().getLayoutSettings().getCurrentLayouter() instanceof IncrementalHierarchicLayouter) {
graph.getSettings().getLayoutSettings().setDefaultGraphLayout(LayoutStyle.HIERARCHIC);
} else if (graph.getSettings().getLayoutSettings().getCurrentLayouter() instanceof OrthogonalLayouter) {
graph.getSettings().getLayoutSettings().setDefaultGraphLayout(LayoutStyle.ORTHOGONAL);
}
if (dlg.needsLayouting()) {
CGraphLayouter.refreshLayout(parent, graph);
}
}
}
use of y.layout.orthogonal.OrthogonalLayouter in project binnavi by google.
the class ZyGraphLayouter method createOrthoLayouter.
public static CanonicMultiStageLayouter createOrthoLayouter(final OrthogonalStyle style, final long gridSize, final boolean isVerticalOrientation) {
Preconditions.checkArgument(gridSize > 0, "Internal Error: Grid size can not be 0 or lower.");
Preconditions.checkNotNull(style, "Internal Error: Layout style can't be null");
final OrthogonalLayouter layouter = new OrthogonalLayouter();
layouter.setLayoutStyle(style == OrthogonalStyle.NORMAL ? OrthogonalLayouter.NORMAL_STYLE : OrthogonalLayouter.NORMAL_TREE_STYLE);
final OrientationLayouter ol = (OrientationLayouter) layouter.getOrientationLayouter();
ol.setOrientation(isVerticalOrientation ? OrientationLayouter.TOP_TO_BOTTOM : OrientationLayouter.LEFT_TO_RIGHT);
layouter.setGrid((int) gridSize);
return layouter;
}
Aggregations