Line | Hits | Source |
---|---|---|
1 | /******************************************************************************* | |
2 | * Demetrix process modelling system | |
3 | * | |
4 | * Copyright (c) 2003, 2004 Dimitri A. Pissarenko | |
5 | * | |
6 | * This file is part of Demetrix. | |
7 | * | |
8 | * Demetrix is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License as published by | |
10 | * the Free Software Foundation; either version 2.1 of the License, or | |
11 | * (at your option) any later version. | |
12 | * | |
13 | * Demetrix is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | * GNU General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with Demetrix; if not, write to the Free Software | |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | * | |
22 | * For further information you may | |
23 | * | |
24 | * - send an e-mail in Russian, German or English to dimitri.pissarenko@gmx.net | |
25 | * - look at http://sourceforge.net/projects/demetrix/ | |
26 | * - look at http://demetrix.sourceforge.net/ | |
27 | * - look at http://members.inode.at/d.pissarenko/ | |
28 | * | |
29 | *****************************************************************************/ | |
30 | package net.sourceforge.demetrix.ui; | |
31 | import java.io.File; | |
32 | import java.util.Iterator; | |
33 | import java.util.LinkedList; | |
34 | ||
35 | import net.sourceforge.demetrix.model.ProcessChainNode; | |
36 | ||
37 | import org.apache.log4j.Logger; | |
38 | /** | |
39 | * @author Dimitri Pissarenko | |
40 | * | |
41 | */ | |
42 | public class CurrentProcessChainSingleton { | |
43 | private static CurrentProcessChainSingleton instance; | |
44 | private boolean topLevelProcessChain; | |
45 | public static CurrentProcessChainSingleton getInstance() { | |
46 | 121 | if (instance == null) { |
47 | 6 | instance = new CurrentProcessChainSingleton(); |
48 | } | |
49 | 121 | return instance; |
50 | } | |
51 | private ProcessChainNode currentGraphParent; | |
52 | private Logger logger=Logger.getLogger(getClass()); | |
53 | private LinkedList observers; | |
54 | private File savingLocation; | |
55 | 6 | private CurrentProcessChainSingleton() { |
56 | 6 | this.observers=new LinkedList(); |
57 | 6 | } |
58 | public void attach(CurrentProcessChainObserver observer) | |
59 | { | |
60 | 20 | this.observers.add(observer); |
61 | 20 | } |
62 | /** | |
63 | * @return | |
64 | */ | |
65 | public ProcessChainNode getCurrentGraphParent() { | |
66 | 45 | return currentGraphParent; |
67 | } | |
68 | /** | |
69 | * @return | |
70 | */ | |
71 | public File getSavingLocation() { | |
72 | 0 | return savingLocation; |
73 | } | |
74 | public void informCurrentGraphParentChanged() | |
75 | { | |
76 | 9 | Iterator iterator=null; |
77 | 9 | CurrentProcessChainObserver observer=null; |
78 | ||
79 | 9 | iterator=this.observers.iterator(); |
80 | ||
81 | 39 | while (iterator.hasNext()) |
82 | { | |
83 | 30 | observer=(CurrentProcessChainObserver)iterator.next(); |
84 | 30 | observer.currentGraphParentChanged(); |
85 | } | |
86 | 9 | } |
87 | /** | |
88 | * @param node | |
89 | */ | |
90 | public void setCurrentGraphParent(ProcessChainNode node) { | |
91 | 10 | currentGraphParent = node; |
92 | 10 | } |
93 | /** | |
94 | * @param file | |
95 | */ | |
96 | public void setSavingLocation(File file) { | |
97 | 5 | savingLocation = file; |
98 | 5 | } |
99 | /** | |
100 | * @return | |
101 | */ | |
102 | public boolean isTopLevelProcessChain() { | |
103 | 23 | return topLevelProcessChain; |
104 | } | |
105 | ||
106 | /** | |
107 | * @param b | |
108 | */ | |
109 | public void setTopLevelProcessChain(boolean b) { | |
110 | 7 | topLevelProcessChain = b; |
111 | 7 | } |
112 | ||
113 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |