1 package com.opensymphony.workflow.designer.event; 2 3 import java.util.EventObject ; 4 5 import com.opensymphony.workflow.loader.Workspace; 6 7 12 public class WorkspaceEvent extends EventObject 13 { 14 public static final int WORKSPACE_OPENED = 1; 15 public static final int WORKSPACE_CLOSED = 2; 16 private int id; 17 private Workspace workspace; 18 private boolean consumed; 19 20 public WorkspaceEvent(Object source) 21 { 22 super(source); 23 } 24 25 public WorkspaceEvent(Object source, Workspace workspace, int id) 26 { 27 super(source); 28 this.id = id; 29 this.workspace = workspace; 30 } 31 32 public int getId() 33 { 34 return id; 35 } 36 37 public Workspace getWorkspace() 38 { 39 return workspace; 40 } 41 42 public boolean isConsumed() 43 { 44 return consumed; 45 } 46 47 public void consume() 48 { 49 consumed = true; 50 } 51 52 public String toString() 53 { 54 StringBuffer sb = new StringBuffer (getClass().getName()); 55 sb.append("["); 56 sb.append("id="); 57 sb.append(id==WORKSPACE_OPENED ? "WORKSPACE_OPENED " : "WORKSPACE_CLOSED "); 58 sb.append("source=").append(source); 59 sb.append("]"); 60 return sb.toString(); 61 } 62 } 63 | Popular Tags |