1 package org
.argeo
.slc
.core
.structure
;
4 import java
.util
.Vector
;
6 import org
.apache
.commons
.logging
.Log
;
7 import org
.apache
.commons
.logging
.LogFactory
;
9 /** Default implementation of a <code>StructureRegistry</code>.*/
10 public class DefaultSRegistry
implements StructureRegistry
{
11 private static Log log
= LogFactory
.getLog(DefaultSRegistry
.class);
13 private List
<StructureElement
> elements
= new Vector
<StructureElement
>();
14 private List
<StructurePath
> paths
= new Vector
<StructurePath
>();
15 private String mode
= StructureRegistry
.ALL
;
17 private List
<StructurePath
> activePaths
;
19 public List
<StructureElement
> listElements() {
20 return new Vector
<StructureElement
>(elements
);
23 public List
<StructurePath
> listPaths() {
24 return new Vector
<StructurePath
>(paths
);
27 public void register(StructurePath path
,StructureElement element
) {
28 StructureElement treeSElement
= element
;
29 elements
.add(treeSElement
);
31 log
.debug("Registered " + path
+ " (desc: '"
32 + treeSElement
.getDescription() + "', position: "
33 + elements
.size() + ")");
36 public void register(StructurePath path
,StructureAware structureAware
) {
37 register(path
,structureAware
.getElement());
38 structureAware
.onRegister(this,path
);
41 public StructureElement
getElement(StructurePath path
) {
42 int index
= paths
.indexOf(path
);
44 return elements
.get(index
);
50 public String
getMode() {
54 public void setMode(String mode
) {
58 public List
<StructurePath
> getActivePaths() {
62 public void setActivePaths(List
<StructurePath
> activePaths
) {
63 this.activePaths
= activePaths
;