public LayoutAction getLayout(String name) { for (LayoutAction layout : layouts) { if (layout.getName().equals(name)) { return layout; } } return null; }
public void addLayoutListener(ProgressListener listener) { for(LayoutAction layout : layouts) { layout.addProgressListener(listener); } }
public void performLayout(LayoutAction layout) { if (layout != null) { layout.runLayout(); } }
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)); }
LayoutAlgorithm layout = getLayoutAlgorithm(); layout.applyLayout(entities, rels, x, y, w, h, false, false); if(!node.isFixedLocation()) { if (animate) { AffineTransform transform = createTransform(node); PActivity activity = createActivity(node, transform); if (activity != null) { activities.add(activity);
protected void addDefaultLayouts() { int style = LayoutStyles.NO_LAYOUT_NODE_RESIZING; addLayout(new LayoutAction(LayoutConstants.LAYOUT_GRID_BY_ALPHA, ResourceHandler.getIcon("icon_grid_layout.gif"), new GridLayoutAlgorithm(style), this)); addLayout(new LayoutAction(LayoutConstants.LAYOUT_RADIAL, ResourceHandler.getIcon("icon_radial_layout.gif"), new RadialLayoutAlgorithm(style), this)); addLayout(new LayoutAction(LayoutConstants.LAYOUT_SPRING, ResourceHandler.getIcon("icon_spring_layout.gif"), new SpringLayoutAlgorithm(style), this)); addLayout(new LayoutAction(LayoutConstants.LAYOUT_TREE_VERTICAL, ResourceHandler.getIcon("icon_tree_layout.gif"), new TreeLayoutAlgorithm(style), this)); addLayout(new LayoutAction(LayoutConstants.LAYOUT_TREE_HORIZONTAL, ResourceHandler.getIcon("icon_tree_layout_horizontal.gif"), new HorizontalTreeLayoutAlgorithm(style), this)); addLayout(new LayoutAction(LayoutConstants.LAYOUT_DIRECTED_VERTICAL, ResourceHandler.getIcon("icon_tree_layout.gif"), new DirectedGraphLayoutAlgorithm(style), this)); addLayout(new LayoutAction(LayoutConstants.LAYOUT_DIRECTED_HORIZONTAL, ResourceHandler.getIcon("icon_tree_layout_horizontal.gif"), new HorizontalDirectedGraphLayoutAlgorithm(style), this)); // important - set the last layout this.lastLayout = getLayout(LayoutConstants.LAYOUT_DIRECTED_VERTICAL); }
public void doAction() { // save this action as the last executed action ((AbstractGraph) graph).setLastLayout(this); runLayout(); }
public void performLayout() { if (getLastLayout() != null) { filterManager.applyFilters(model); getLastLayout().runLayout(); } }