Search in sources :

Example 1 with OrthogonalLayouter

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);
        }
    }
}
Also used : CircularLayouter(y.layout.circular.CircularLayouter) IncrementalHierarchicLayouter(y.layout.hierarchic.IncrementalHierarchicLayouter) OrthogonalLayouter(y.layout.orthogonal.OrthogonalLayouter) CGraphSettingsDialog(com.google.security.zynamics.binnavi.Gui.GraphSettings.CGraphSettingsDialog)

Example 2 with OrthogonalLayouter

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;
}
Also used : OrthogonalLayouter(y.layout.orthogonal.OrthogonalLayouter) OrientationLayouter(y.layout.OrientationLayouter)

Aggregations

OrthogonalLayouter (y.layout.orthogonal.OrthogonalLayouter)2 CGraphSettingsDialog (com.google.security.zynamics.binnavi.Gui.GraphSettings.CGraphSettingsDialog)1 OrientationLayouter (y.layout.OrientationLayouter)1 CircularLayouter (y.layout.circular.CircularLayouter)1 IncrementalHierarchicLayouter (y.layout.hierarchic.IncrementalHierarchicLayouter)1