本文整理汇总了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;
}
示例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.");
}
}