|
@@ -1,47 +1,47 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.forms.client.nonpublic; |
3 |
|
- |
|
4 |
|
- |
import java.util.*; |
5 |
|
- |
|
6 |
|
- |
public interface RelSubFormTypeHelperParentable { |
7 |
|
- |
public RelSubFormTypeHelper getChild( String pRelAttribute ); |
8 |
|
- |
|
9 |
|
- |
public void addChild( RelSubFormTypeHelper pChildFactory ); |
10 |
|
- |
|
11 |
|
- |
public void removeChild( RelSubFormTypeHelper pChildFactory ); |
12 |
|
- |
|
13 |
|
- |
public Integer getFormUniqueID(); |
14 |
|
- |
|
15 |
|
- |
public class ChildManager { |
16 |
|
- |
private boolean mActive = true; |
17 |
|
- |
private Map mChildrenByRelAtribute = new HashMap(); |
18 |
|
- |
|
19 |
|
- |
public RelSubFormTypeHelper getChild( String pRelAttribute ) { |
20 |
|
- |
return (RelSubFormTypeHelper) mChildrenByRelAtribute.get( pRelAttribute ); |
21 |
|
- |
} |
22 |
|
- |
|
23 |
|
- |
public void addChild( RelSubFormTypeHelper pChildFactory ) { |
24 |
|
- |
if ( mActive && (pChildFactory != null) ) { |
25 |
|
- |
mChildrenByRelAtribute.put( pChildFactory.getRelAttribute(), pChildFactory ); |
26 |
|
- |
} |
27 |
|
- |
} |
28 |
|
- |
|
29 |
|
- |
public void removeChild( RelSubFormTypeHelper pChildFactory ) { |
30 |
|
- |
if ( mActive && (pChildFactory != null) ) { |
31 |
|
- |
mChildrenByRelAtribute.remove( pChildFactory.getRelAttribute() ); |
32 |
|
- |
} |
33 |
|
- |
} |
34 |
|
- |
|
35 |
|
- |
public void dispose() { |
36 |
|
- |
if ( mActive ) { |
37 |
|
- |
mActive = false; |
38 |
|
- |
if ( !mChildrenByRelAtribute.isEmpty() ) { |
39 |
|
- |
for ( Iterator it = mChildrenByRelAtribute.values().iterator(); it.hasNext(); ) { |
40 |
|
- |
((RelSubFormTypeHelper) it.next()).dispose(); |
41 |
|
- |
} |
42 |
|
- |
} |
43 |
|
- |
mChildrenByRelAtribute.clear(); |
44 |
|
- |
} |
45 |
|
- |
} |
46 |
|
- |
} |
47 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.forms.client.nonpublic; |
|
3 |
+ |
|
|
4 |
+ |
import java.util.*; |
|
5 |
+ |
|
|
6 |
+ |
public interface RelSubFormTypeHelperParentable { |
|
7 |
+ |
public RelSubFormTypeHelper getChild( String pRelAttribute ); |
|
8 |
+ |
|
|
9 |
+ |
public void addChild( RelSubFormTypeHelper pChildFactory ); |
|
10 |
+ |
|
|
11 |
+ |
public void removeChild( RelSubFormTypeHelper pChildFactory ); |
|
12 |
+ |
|
|
13 |
+ |
public Integer getFormUniqueID(); |
|
14 |
+ |
|
|
15 |
+ |
public class ChildManager { |
|
16 |
+ |
private boolean mActive = true; |
|
17 |
+ |
private Map mChildrenByRelAtribute = new HashMap(); |
|
18 |
+ |
|
|
19 |
+ |
public RelSubFormTypeHelper getChild( String pRelAttribute ) { |
|
20 |
+ |
return (RelSubFormTypeHelper) mChildrenByRelAtribute.get( pRelAttribute ); |
|
21 |
+ |
} |
|
22 |
+ |
|
|
23 |
+ |
public void addChild( RelSubFormTypeHelper pChildFactory ) { |
|
24 |
+ |
if ( mActive && (pChildFactory != null) ) { |
|
25 |
+ |
mChildrenByRelAtribute.put( pChildFactory.getRelAttribute(), pChildFactory ); |
|
26 |
+ |
} |
|
27 |
+ |
} |
|
28 |
+ |
|
|
29 |
+ |
public void removeChild( RelSubFormTypeHelper pChildFactory ) { |
|
30 |
+ |
if ( mActive && (pChildFactory != null) ) { |
|
31 |
+ |
mChildrenByRelAtribute.remove( pChildFactory.getRelAttribute() ); |
|
32 |
+ |
} |
|
33 |
+ |
} |
|
34 |
+ |
|
|
35 |
+ |
public void dispose() { |
|
36 |
+ |
if ( mActive ) { |
|
37 |
+ |
mActive = false; |
|
38 |
+ |
if ( !mChildrenByRelAtribute.isEmpty() ) { |
|
39 |
+ |
for ( Iterator it = mChildrenByRelAtribute.values().iterator(); it.hasNext(); ) { |
|
40 |
+ |
((RelSubFormTypeHelper) it.next()).dispose(); |
|
41 |
+ |
} |
|
42 |
+ |
} |
|
43 |
+ |
mChildrenByRelAtribute.clear(); |
|
44 |
+ |
} |
|
45 |
+ |
} |
|
46 |
+ |
} |
|
47 |
+ |
} |