Package com.acelet.s.workflow

Source Code of com.acelet.s.workflow.CellType

/* Copyright 1999-2008 Acelet.org. All rights reserved. GPL v2 license */
/** @author Wei Jiang */

package com.acelet.s.workflow;

import org.jgraph.JGraph;
import org.jgraph.graph.AttributeMap;
import org.jgraph.graph.DefaultEdge;
import org.jgraph.graph.DefaultGraphCell;
import org.jgraph.graph.DefaultPort;

public class CellType {
  static String CELL_TYPE_KEY = "cellType";
  static String CELL_TYPE_ACTION = "action";

  public static boolean isCellActionCell(Object cellObject) {
    if (cellObject == null || (cellObject instanceof DefaultGraphCell) == false)
        return false;

    if (cellObject instanceof DefaultEdge)
      return false;
    else if (cellObject instanceof DefaultPort)
      return false;
    else if (cellObject instanceof DefaultGraphCell) {
      DefaultGraphCell defaultGraphCell = (DefaultGraphCell) cellObject;
      AttributeMap attributes = defaultGraphCell.getAttributes();
      String type = (String) attributes.get(CELL_TYPE_KEY);
      if (type != null && type.equals(CELL_TYPE_ACTION))
        return true;
      else
        return false;
    } else
      return false;
  }
}
TOP

Related Classes of com.acelet.s.workflow.CellType

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.