private void initialize(Container parentContainer) { // setup the layouts List<Object> layoutRelTypes = new ArrayList<Object>(); layoutRelTypes.add(ProtegeGraphModel.DIRECT_SUBCLASS_SLOT_TYPE); layoutRelTypes.add(ProtegeGraphModel.DIRECT_INDIVIDUAL_SLOT_TYPE); for (LayoutAction layoutAction : graph.getLayouts()) { if (layoutAction.getName().equals(LayoutConstants.LAYOUT_TREE_HORIZONTAL)) { layoutAction.setLayout(new HorizontalDirectedGraphLayoutAlgorithm()); this.graph.setLastLayout(layoutAction); layoutAction.setLayoutRelTypes(layoutRelTypes); } else if (layoutAction.getName().equals(LayoutConstants.LAYOUT_TREE_VERTICAL)) { layoutAction.setLayout(new DirectedGraphLayoutAlgorithm()); layoutAction.setLayoutRelTypes(layoutRelTypes); } } view = new DefaultFlatGraphView(graph); parentContainer.add(view, BorderLayout.CENTER); initNodeMenu(graph.getNodeContextMenu()); graph.addInputEventListener(new ProtegeInputEventHandler(model, graph)); }
for (LayoutAction layoutAction : graph.getLayouts()) { if (layoutAction.getName().equals(LayoutConstants.LAYOUT_SPRING)) { layoutAction.setLayout(new HorizontalDirectedGraphLayoutAlgorithm());
private void initializeToolBar() { // Home addToolBarAction(new FocusOnHomeAction(graph.getAnimationHandler())); addToolBarAction(new ClearOrphansAction(graph.getModel(), graph)); getToolBar().addSeparator(); // Layouts for (LayoutAction action : graph.getLayouts()) { addToolBarAction(action); } getToolBar().addSeparator(); // zoom addToolBarAction(new ZoomInAction(graph.getCamera())); addToolBarAction(new NoZoomAction(graph.getCamera())); addToolBarAction(new ZoomOutAction(graph.getCamera())); getToolBar().addSeparator(); // node and arc filter actions final JToggleButton nodesToggle = addToolBarToggleAction(new ShowFilterPanelAction(getNodeFilterPanel())); final JToggleButton arcsToggle = addToolBarToggleAction(new ShowFilterPanelAction(getArcFilterPanel())); // listen for panel close events - keep the toggle buttons in sync getNodeFilterPanel().getCloseButton().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { nodesToggle.setSelected(false); } }); getArcFilterPanel().getCloseButton().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { arcsToggle.setSelected(false); } }); }