* @return an action that executes the specified layout
*/
@SuppressWarnings("serial")
public Action graphLayout(final String key, boolean animate)
{
final mxIGraphLayout layout = createLayout(key, animate);
if (layout != null)
{
return new AbstractAction(mxResources.get(key))
{
public void actionPerformed(ActionEvent e)
{
final mxGraph graph = graphComponent.getGraph();
Object cell = graph.getSelectionCell();
if (cell == null
|| graph.getModel().getChildCount(cell) == 0)
{
cell = graph.getDefaultParent();
}
graph.getModel().beginUpdate();
try
{
long t0 = System.currentTimeMillis();
layout.execute(cell);
status("Layout: " + (System.currentTimeMillis() - t0)
+ " ms");
}
finally
{