new PageBackgroundAction()));
submenu = (JMenu) menu.add(new JMenu(mxResources.get("grid")));
submenu.add(editor.bind(mxResources.get("gridSize"),
new PromptPropertyAction(graph, "Grid Size", "GridSize")));
submenu.add(editor.bind(mxResources.get("gridColor"),
new GridColorAction()));
submenu.addSeparator();
submenu.add(editor.bind(mxResources.get("dashed"), new GridStyleAction(
mxGraphComponent.GRID_STYLE_DASHED)));
submenu.add(editor.bind(mxResources.get("dot"), new GridStyleAction(
mxGraphComponent.GRID_STYLE_DOT)));
submenu.add(editor.bind(mxResources.get("line"), new GridStyleAction(
mxGraphComponent.GRID_STYLE_LINE)));
submenu.add(editor.bind(mxResources.get("cross"), new GridStyleAction(
mxGraphComponent.GRID_STYLE_CROSS)));
menu.addSeparator();
submenu = (JMenu) menu.add(new JMenu(mxResources.get("layout")));
submenu.add(editor.graphLayout("verticalHierarchical", true));
submenu.add(editor.graphLayout("horizontalHierarchical", true));
submenu.addSeparator();
submenu.add(editor.graphLayout("verticalPartition", false));
submenu.add(editor.graphLayout("horizontalPartition", false));
submenu.addSeparator();
submenu.add(editor.graphLayout("verticalStack", false));
submenu.add(editor.graphLayout("horizontalStack", false));
submenu.addSeparator();
submenu.add(editor.graphLayout("verticalTree", true));
submenu.add(editor.graphLayout("horizontalTree", true));
submenu.addSeparator();
submenu.add(editor.graphLayout("parallelEdges", false));
submenu.addSeparator();
submenu.add(editor.graphLayout("organicLayout", true));
submenu = (JMenu) menu.add(new JMenu(mxResources.get("selection")));
submenu.add(editor.bind(mxResources.get("selectPath"),
new SelectShortestPathAction(false)));
submenu.add(editor.bind(mxResources.get("selectDirectedPath"),
new SelectShortestPathAction(true)));
submenu.addSeparator();
submenu.add(editor.bind(mxResources.get("selectTree"),
new SelectSpanningTreeAction(false)));
submenu.add(editor.bind(mxResources.get("selectDirectedTree"),
new SelectSpanningTreeAction(true)));
menu.addSeparator();
submenu = (JMenu) menu.add(new JMenu(mxResources.get("stylesheet")));
submenu
.add(editor
.bind(
mxResources.get("basicStyle"),
new StylesheetAction(
"/com/mxgraph/examples/swing/resources/basic-style.xml")));
submenu
.add(editor
.bind(
mxResources.get("defaultStyle"),
new StylesheetAction(
"/com/mxgraph/examples/swing/resources/default-style.xml")));
// Creates the options menu
menu = add(new JMenu(mxResources.get("options")));
submenu = (JMenu) menu.add(new JMenu(mxResources.get("display")));
submenu.add(new TogglePropertyItem(graphComponent, mxResources
.get("buffering"), "TripleBuffered", true));
submenu.add(editor.bind(mxResources.get("dirty"),
new ToggleDirtyAction()));
submenu.addSeparator();
item = submenu.add(new TogglePropertyItem(graphComponent, mxResources
.get("centerPage"), "CenterPage", true, new ActionListener()
{
/**
*
*/
public void actionPerformed(ActionEvent e)
{
if (graphComponent.isPageVisible()
&& graphComponent.isCenterPage())
{
graphComponent.zoomAndCenter();
}
}
}));
submenu.add(new TogglePropertyItem(graphComponent, mxResources
.get("centerZoom"), "CenterZoom", true));
submenu.add(new TogglePropertyItem(graphComponent, mxResources
.get("zoomToSelection"), "KeepSelectionVisibleOnZoom", true));
submenu.addSeparator();
submenu.add(new TogglePropertyItem(graphComponent, mxResources
.get("preferPagesize"), "PreferPageSize", true));
// This feature is not yet implemented
//submenu.add(new TogglePropertyItem(graphComponent, mxResources
// .get("pageBreaks"), "PageBreaksVisible", true));
submenu.addSeparator();
submenu.add(editor.bind(mxResources.get("tolerance"),
new PromptPropertyAction(graph, "Tolerance")));
// Creates the window menu
menu = add(new JMenu(mxResources.get("window")));
UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels();