|
@@ -1,108 +1,108 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.forms.client.nonpublic; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.ui.def.nonpublic.support.*; |
5 |
|
- |
|
6 |
|
- |
import java.util.*; |
7 |
|
- |
|
8 |
|
- |
public class RelSubFormInstanceChildManager { |
9 |
|
- |
private static RelSubFormInstanceComponentHandlerImpl[] EMPTY_ARRAY = new RelSubFormInstanceComponentHandlerImpl[0]; |
10 |
|
- |
|
11 |
|
- |
private RelSubFormInstanceComponentHandlerImpl[] mChildren = EMPTY_ARRAY; |
12 |
|
- |
private Map mChildrenByFormUniqueIDs = new HashMap(); |
13 |
|
- |
|
14 |
|
- |
public boolean anyChildren() { |
15 |
|
- |
return (mChildren.length != 0); |
16 |
|
- |
} |
17 |
|
- |
|
18 |
|
- |
public void addChild( RelSubFormInstanceComponentHandlerImpl pComponentHandler ) { |
19 |
|
- |
mChildrenByFormUniqueIDs.put( pComponentHandler.getFormUniqueID(), pComponentHandler ); |
20 |
|
- |
mChildren = append( mChildren, pComponentHandler ); |
21 |
|
- |
} |
22 |
|
- |
|
23 |
|
- |
public void dispose( UberFormInstanceComponentHandler pUberHandler ) { |
24 |
|
- |
for ( int i = 0; i < mChildren.length; i++ ) { |
25 |
|
- |
mChildren[i].dispose( pUberHandler ); |
26 |
|
- |
} |
27 |
|
- |
mChildren = EMPTY_ARRAY; |
28 |
|
- |
mChildrenByFormUniqueIDs.clear(); |
29 |
|
- |
mChildrenByFormUniqueIDs = null; |
30 |
|
- |
} |
31 |
|
- |
|
32 |
|
- |
public void apply( ActionUpdateFormData[] pActionUpdates ) { |
33 |
|
- |
for ( int i = 0; i < mChildren.length; i++ ) { |
34 |
|
- |
mChildren[i].apply( pActionUpdates ); |
35 |
|
- |
} |
36 |
|
- |
} |
37 |
|
- |
|
38 |
|
- |
public void updateInputState( boolean pAnyChanged, boolean pAnyErrors ) { |
39 |
|
- |
for ( int i = 0; i < mChildren.length; i++ ) { |
40 |
|
- |
mChildren[i].updateInputState( pAnyChanged, pAnyErrors ); |
41 |
|
- |
} |
42 |
|
- |
} |
43 |
|
- |
|
44 |
|
- |
public boolean setActionDisabled( FormDataRowKey pFormDataRowKey, String pActionID, boolean pDisabled ) { |
45 |
|
- |
for ( int i = 0; i < mChildren.length; i++ ) { |
46 |
|
- |
if ( mChildren[i].setActionDisabled( pFormDataRowKey, pActionID, pDisabled ) ) { |
47 |
|
- |
return true; |
48 |
|
- |
} |
49 |
|
- |
} |
50 |
|
- |
return false; |
51 |
|
- |
} |
52 |
|
- |
|
53 |
|
- |
public boolean setInputDisabled( FormDataRowKey pFormDataRowKey, String pAttributeName, boolean pDisabled ) { |
54 |
|
- |
for ( int i = 0; i < mChildren.length; i++ ) { |
55 |
|
- |
if ( mChildren[i].setInputDisabled( pFormDataRowKey, pAttributeName, pDisabled ) ) { |
56 |
|
- |
return true; |
57 |
|
- |
} |
58 |
|
- |
} |
59 |
|
- |
return false; |
60 |
|
- |
} |
61 |
|
- |
|
62 |
|
- |
public void apply( AttributeUpdateFormData[] pAttributeUpdates ) { |
63 |
|
- |
for ( int i = 0; i < mChildren.length; i++ ) { |
64 |
|
- |
mChildren[i].apply( pAttributeUpdates ); |
65 |
|
- |
} |
66 |
|
- |
} |
67 |
|
- |
|
68 |
|
- |
public boolean anyUserInitiatedRowChange() { |
69 |
|
- |
for ( int i = 0; i < mChildren.length; i++ ) { |
70 |
|
- |
if ( mChildren[i].anyUserInitiatedRowChange() ) { |
71 |
|
- |
return true; |
72 |
|
- |
} |
73 |
|
- |
} |
74 |
|
- |
return false; |
75 |
|
- |
} |
76 |
|
- |
|
77 |
|
- |
public boolean recalcAnyAttributes( FormAttributeAdapter.BooleanValueAccessor pValueAccessor ) { |
78 |
|
- |
for ( int i = 0; i < mChildren.length; i++ ) { |
79 |
|
- |
if ( mChildren[i].recalcAnyAttributes( pValueAccessor ) ) { |
80 |
|
- |
return true; |
81 |
|
- |
} |
82 |
|
- |
} |
83 |
|
- |
return false; |
84 |
|
- |
} |
85 |
|
- |
|
86 |
|
- |
public void publishAnyPendingAttributeChanges() { |
87 |
|
- |
for ( int i = 0; i < mChildren.length; i++ ) { |
88 |
|
- |
mChildren[i].publishAnyPendingAttributeChanges(); |
89 |
|
- |
} |
90 |
|
- |
} |
91 |
|
- |
|
92 |
|
- |
public void apply( RelSubFormRowKeys[] pList, boolean pFullUpdate, boolean pUserInitiatedAddOrRemoveRow ) { |
93 |
|
- |
for ( int i = 0; i < mChildren.length; i++ ) { |
94 |
|
- |
mChildren[i].apply( pList, pFullUpdate, pUserInitiatedAddOrRemoveRow ); |
95 |
|
- |
} |
96 |
|
- |
} |
97 |
|
- |
|
98 |
|
- |
private static RelSubFormInstanceComponentHandlerImpl[] append( RelSubFormInstanceComponentHandlerImpl[] pOrig, |
99 |
|
- |
RelSubFormInstanceComponentHandlerImpl pNew ) { |
100 |
|
- |
RelSubFormInstanceComponentHandlerImpl[] newArray = new RelSubFormInstanceComponentHandlerImpl[pOrig.length + 1]; |
101 |
|
- |
int i = 0; |
102 |
|
- |
for (; i < pOrig.length; i++ ) { |
103 |
|
- |
newArray[i] = pOrig[i]; |
104 |
|
- |
} |
105 |
|
- |
newArray[i] = pNew; |
106 |
|
- |
return newArray; |
107 |
|
- |
} |
108 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.forms.client.nonpublic; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.ui.def.nonpublic.support.*; |
|
5 |
+ |
|
|
6 |
+ |
import java.util.*; |
|
7 |
+ |
|
|
8 |
+ |
public class RelSubFormInstanceChildManager { |
|
9 |
+ |
private static RelSubFormInstanceComponentHandlerImpl[] EMPTY_ARRAY = new RelSubFormInstanceComponentHandlerImpl[0]; |
|
10 |
+ |
|
|
11 |
+ |
private RelSubFormInstanceComponentHandlerImpl[] mChildren = EMPTY_ARRAY; |
|
12 |
+ |
private Map mChildrenByFormUniqueIDs = new HashMap(); |
|
13 |
+ |
|
|
14 |
+ |
public boolean anyChildren() { |
|
15 |
+ |
return (mChildren.length != 0); |
|
16 |
+ |
} |
|
17 |
+ |
|
|
18 |
+ |
public void addChild( RelSubFormInstanceComponentHandlerImpl pComponentHandler ) { |
|
19 |
+ |
mChildrenByFormUniqueIDs.put( pComponentHandler.getFormUniqueID(), pComponentHandler ); |
|
20 |
+ |
mChildren = append( mChildren, pComponentHandler ); |
|
21 |
+ |
} |
|
22 |
+ |
|
|
23 |
+ |
public void dispose( UberFormInstanceComponentHandler pUberHandler ) { |
|
24 |
+ |
for ( int i = 0; i < mChildren.length; i++ ) { |
|
25 |
+ |
mChildren[i].dispose( pUberHandler ); |
|
26 |
+ |
} |
|
27 |
+ |
mChildren = EMPTY_ARRAY; |
|
28 |
+ |
mChildrenByFormUniqueIDs.clear(); |
|
29 |
+ |
mChildrenByFormUniqueIDs = null; |
|
30 |
+ |
} |
|
31 |
+ |
|
|
32 |
+ |
public void apply( ActionUpdateFormData[] pActionUpdates ) { |
|
33 |
+ |
for ( int i = 0; i < mChildren.length; i++ ) { |
|
34 |
+ |
mChildren[i].apply( pActionUpdates ); |
|
35 |
+ |
} |
|
36 |
+ |
} |
|
37 |
+ |
|
|
38 |
+ |
public void updateInputState( boolean pAnyChanged, boolean pAnyErrors ) { |
|
39 |
+ |
for ( int i = 0; i < mChildren.length; i++ ) { |
|
40 |
+ |
mChildren[i].updateInputState( pAnyChanged, pAnyErrors ); |
|
41 |
+ |
} |
|
42 |
+ |
} |
|
43 |
+ |
|
|
44 |
+ |
public boolean setActionDisabled( FormDataRowKey pFormDataRowKey, String pActionID, boolean pDisabled ) { |
|
45 |
+ |
for ( int i = 0; i < mChildren.length; i++ ) { |
|
46 |
+ |
if ( mChildren[i].setActionDisabled( pFormDataRowKey, pActionID, pDisabled ) ) { |
|
47 |
+ |
return true; |
|
48 |
+ |
} |
|
49 |
+ |
} |
|
50 |
+ |
return false; |
|
51 |
+ |
} |
|
52 |
+ |
|
|
53 |
+ |
public boolean setInputDisabled( FormDataRowKey pFormDataRowKey, String pAttributeName, boolean pDisabled ) { |
|
54 |
+ |
for ( int i = 0; i < mChildren.length; i++ ) { |
|
55 |
+ |
if ( mChildren[i].setInputDisabled( pFormDataRowKey, pAttributeName, pDisabled ) ) { |
|
56 |
+ |
return true; |
|
57 |
+ |
} |
|
58 |
+ |
} |
|
59 |
+ |
return false; |
|
60 |
+ |
} |
|
61 |
+ |
|
|
62 |
+ |
public void apply( AttributeUpdateFormData[] pAttributeUpdates ) { |
|
63 |
+ |
for ( int i = 0; i < mChildren.length; i++ ) { |
|
64 |
+ |
mChildren[i].apply( pAttributeUpdates ); |
|
65 |
+ |
} |
|
66 |
+ |
} |
|
67 |
+ |
|
|
68 |
+ |
public boolean anyUserInitiatedRowChange() { |
|
69 |
+ |
for ( int i = 0; i < mChildren.length; i++ ) { |
|
70 |
+ |
if ( mChildren[i].anyUserInitiatedRowChange() ) { |
|
71 |
+ |
return true; |
|
72 |
+ |
} |
|
73 |
+ |
} |
|
74 |
+ |
return false; |
|
75 |
+ |
} |
|
76 |
+ |
|
|
77 |
+ |
public boolean recalcAnyAttributes( FormAttributeAdapter.BooleanValueAccessor pValueAccessor ) { |
|
78 |
+ |
for ( int i = 0; i < mChildren.length; i++ ) { |
|
79 |
+ |
if ( mChildren[i].recalcAnyAttributes( pValueAccessor ) ) { |
|
80 |
+ |
return true; |
|
81 |
+ |
} |
|
82 |
+ |
} |
|
83 |
+ |
return false; |
|
84 |
+ |
} |
|
85 |
+ |
|
|
86 |
+ |
public void publishAnyPendingAttributeChanges() { |
|
87 |
+ |
for ( int i = 0; i < mChildren.length; i++ ) { |
|
88 |
+ |
mChildren[i].publishAnyPendingAttributeChanges(); |
|
89 |
+ |
} |
|
90 |
+ |
} |
|
91 |
+ |
|
|
92 |
+ |
public void apply( RelSubFormRowKeys[] pList, boolean pFullUpdate, boolean pUserInitiatedAddOrRemoveRow ) { |
|
93 |
+ |
for ( int i = 0; i < mChildren.length; i++ ) { |
|
94 |
+ |
mChildren[i].apply( pList, pFullUpdate, pUserInitiatedAddOrRemoveRow ); |
|
95 |
+ |
} |
|
96 |
+ |
} |
|
97 |
+ |
|
|
98 |
+ |
private static RelSubFormInstanceComponentHandlerImpl[] append( RelSubFormInstanceComponentHandlerImpl[] pOrig, |
|
99 |
+ |
RelSubFormInstanceComponentHandlerImpl pNew ) { |
|
100 |
+ |
RelSubFormInstanceComponentHandlerImpl[] newArray = new RelSubFormInstanceComponentHandlerImpl[pOrig.length + 1]; |
|
101 |
+ |
int i = 0; |
|
102 |
+ |
for (; i < pOrig.length; i++ ) { |
|
103 |
+ |
newArray[i] = pOrig[i]; |
|
104 |
+ |
} |
|
105 |
+ |
newArray[i] = pNew; |
|
106 |
+ |
return newArray; |
|
107 |
+ |
} |
|
108 |
+ |
} |