1 10 11 package org.enhydra.jawe; 12 13 import org.jgraph.graph.*; 14 import org.jgraph.JGraph; 15 16 import java.util.*; 17 import org.enhydra.jawe.PackageEditor; 18 19 22 public class JaWEGraphSelectionModel extends DefaultGraphSelectionModel { 23 24 25 public JaWEGraphSelectionModel(JGraph graph) { 26 super(graph); 27 } 28 29 32 public void setSelectionCells(Object [] cells) { 33 super.setSelectionCells(removeForbiddenCells(cells)); 34 } 35 36 39 public void addSelectionCells(Object [] cells) { 40 super.addSelectionCells(removeForbiddenCells(cells)); 41 } 42 43 46 public void removeSelectionCells(Object [] cells) { 47 super.removeSelectionCells(removeForbiddenCells(cells)); 48 } 49 50 53 private Object [] removeForbiddenCells (Object [] cells) { 54 70 return cells; 71 } 72 73 78 public Object [] getSelectables() { 79 Object [] selectables=super.getSelectables(); 80 81 if (selectables!=null && selectables.length>0) { 82 Set removedForbiddenElements=new HashSet(); 83 for (int i=0; i<selectables.length; i++) { 84 removedForbiddenElements.add(selectables[i]); 86 } 88 selectables=removedForbiddenElements.toArray(); 89 } 90 return selectables; 91 } 92 93 } 94 95 96 | Popular Tags |