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