当前位置: 首页>>代码示例>>Java>>正文


Java VizState类代码示例

本文整理汇总了Java中edu.mit.csail.sdg.alloy4viz.VizState的典型用法代码示例。如果您正苦于以下问题:Java VizState类的具体用法?Java VizState怎么用?Java VizState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VizState类属于edu.mit.csail.sdg.alloy4viz包,在下文中一共展示了VizState类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGraph

import edu.mit.csail.sdg.alloy4viz.VizState; //导入依赖的package包/类
public JFrame getGraph() {
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
      | UnsupportedLookAndFeelException e1) {
    e1.printStackTrace();
  }

  final AlloyInstance instance = StaticInstanceMaker.createInstance(this.universe);
  final VizState myState = new VizState(instance);
  final JFrame frame = new JFrame("Visualization");
  final VizGraphPanel graph = new VizGraphPanel(myState, false);

  frame.add(graph);
  graph.alloyGetViewer().alloyRepaint();

  return frame;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:19,代码来源:Visualization.java

示例2: showViz

import edu.mit.csail.sdg.alloy4viz.VizState; //导入依赖的package包/类
private void showViz() {
  if (AlloySolutionSelectionPage.container == null) {
    return;
  }

  if (!AlloyUtilities.isExists()) {
    if (AlloySolutionSelectionPage.frame != null) {
      if (AlloySolutionSelectionPage.frame.getComponentCount() > 0) {
        AlloySolutionSelectionPage.frame.removeAll();
      }
      AlloySolutionSelectionPage.frame.add(new JPanel());
    } else if (AlloySolutionSelectionPage.frame == null) {
      AlloySolutionSelectionPage.frame = SWT_AWT.new_Frame(AlloySolutionSelectionPage.container);
      AlloySolutionSelectionPage.frame.add(new JPanel());
    }
    return;
  }
  AlloySolutionSelectionPage.f = new File(getLocation());
  try {
    if (!AlloySolutionSelectionPage.f.exists()) {
      throw new IOException("File " + getLocation() + " does not exist.");
    }
    final AlloyInstance instance =
        StaticInstanceReader.parseInstance(AlloySolutionSelectionPage.f);

    AlloyUtilities.setAllImpactsAndChanges(instance);

    AlloySolutionSelectionPage.myState = new VizState(instance);

    // FE
    AlloySolutionSelectionPage.myState.mergeArrows.put(null, false);

    if (AlloySolutionSelectionPage.frame == null) {
      AlloySolutionSelectionPage.frame = SWT_AWT.new_Frame(AlloySolutionSelectionPage.container);
    }

    if (AlloySolutionSelectionPage.graph != null
        && AlloySolutionSelectionPage.frame.getComponent(0) != null) {
      AlloySolutionSelectionPage.frame.remove(AlloySolutionSelectionPage.graph);
    }

    try {
      /*
       * TODO BUG
       * 
       * A Fatal Error occurs while setting GTK look and feel on Ubuntu 16.04
       * (com.sun.java.swing.plaf.gtk.GTKLookAndFeel).
       * 
       */
      final String LaF = UIManager.getSystemLookAndFeelClassName();
      if ("com.sun.java.swing.plaf.gtk.GTKLookAndFeel".equals(LaF)) {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
      } else {
        UIManager.setLookAndFeel(LaF);
      }
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
        | UnsupportedLookAndFeelException e1) {
      e1.printStackTrace();
    }
    AlloySolutionSelectionPage.graph =
        new VizGraphPanel(AlloySolutionSelectionPage.myState, false);
    AlloySolutionSelectionPage.frame.removeAll();
    AlloySolutionSelectionPage.frame.add(AlloySolutionSelectionPage.graph);
    AlloySolutionSelectionPage.frame.setVisible(true);
    AlloySolutionSelectionPage.frame.setAlwaysOnTop(true);
    AlloySolutionSelectionPage.graph.alloyGetViewer().alloyRepaint();

  } catch (final Err | IOException e) {
    e.printStackTrace();
    setErrorMessage("An error has occured while Alloy visualization.");
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:73,代码来源:AlloySolutionSelectionPage.java


注:本文中的edu.mit.csail.sdg.alloy4viz.VizState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。