|
@@ -1,29 +1,23 @@ |
1 |
1 |
|
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
2 |
|
package org.litesoft.GWT.forms.server.support; |
3 |
3 |
|
|
4 |
|
- |
import java.util.*; |
5 |
|
- |
|
6 |
4 |
|
import org.litesoft.GWT.forms.server.*; |
7 |
5 |
|
import org.litesoft.ui.def.nonpublic.support.*; |
8 |
6 |
|
|
9 |
|
- |
public class InstanceHelperManager |
10 |
|
- |
{ |
|
7 |
+ |
import java.util.*; |
|
8 |
+ |
|
|
9 |
+ |
public class InstanceHelperManager { |
11 |
10 |
|
private InstanceHelper mRootInstanceHelper = null; |
12 |
11 |
|
private Map<FormDataRowKey, InstanceHelper> mInstanceHelpersByFormDataRowKeys = // null key supported |
13 |
12 |
|
new HashMap<FormDataRowKey, InstanceHelper>(); |
14 |
13 |
|
|
15 |
|
- |
public synchronized void dispose() |
16 |
|
- |
{ |
17 |
|
- |
if ( mInstanceHelpersByFormDataRowKeys != null ) |
18 |
|
- |
{ |
19 |
|
- |
for ( InstanceHelper helper : mInstanceHelpersByFormDataRowKeys.values() ) |
20 |
|
- |
{ |
21 |
|
- |
try |
22 |
|
- |
{ |
|
14 |
+ |
public synchronized void dispose() { |
|
15 |
+ |
if ( mInstanceHelpersByFormDataRowKeys != null ) { |
|
16 |
+ |
for ( InstanceHelper helper : mInstanceHelpersByFormDataRowKeys.values() ) { |
|
17 |
+ |
try { |
23 |
18 |
|
helper.dispose(); |
24 |
19 |
|
} |
25 |
|
- |
catch ( RuntimeException e ) |
26 |
|
- |
{ |
|
20 |
+ |
catch ( RuntimeException e ) { |
27 |
21 |
|
FormServicePeer.LOGGER.error.log( e ); |
28 |
22 |
|
} |
29 |
23 |
|
} |
|
@@ -33,66 +27,53 @@ |
33 |
27 |
|
} |
34 |
28 |
|
} |
35 |
29 |
|
|
36 |
|
- |
public synchronized InstanceHelper getRootInstanceHelper() |
37 |
|
- |
{ |
|
30 |
+ |
public synchronized InstanceHelper getRootInstanceHelper() { |
38 |
31 |
|
return mRootInstanceHelper; |
39 |
32 |
|
} |
40 |
33 |
|
|
41 |
|
- |
public synchronized void setRootInstanceHelper( InstanceHelper pRootInstanceHelper ) |
42 |
|
- |
{ |
|
34 |
+ |
public synchronized void setRootInstanceHelper( InstanceHelper pRootInstanceHelper ) { |
43 |
35 |
|
add( mRootInstanceHelper = pRootInstanceHelper ); |
44 |
36 |
|
} |
45 |
37 |
|
|
46 |
|
- |
public synchronized void add( InstanceHelper pInstanceHelper ) |
47 |
|
- |
{ |
|
38 |
+ |
public synchronized void add( InstanceHelper pInstanceHelper ) { |
48 |
39 |
|
mInstanceHelpersByFormDataRowKeys.put( pInstanceHelper.getFormDataRowKey(), pInstanceHelper ); |
49 |
40 |
|
} |
50 |
41 |
|
|
51 |
|
- |
public synchronized void remove( FormDataRowKey pFormDataRowKey ) |
52 |
|
- |
{ |
|
42 |
+ |
public synchronized void remove( FormDataRowKey pFormDataRowKey ) { |
53 |
43 |
|
mInstanceHelpersByFormDataRowKeys.remove( pFormDataRowKey ); |
54 |
44 |
|
} |
55 |
45 |
|
|
56 |
|
- |
public synchronized void resetAllInstanceHelpers() |
57 |
|
- |
{ |
58 |
|
- |
for ( InstanceHelper helper : mInstanceHelpersByFormDataRowKeys.values() ) |
59 |
|
- |
{ |
60 |
|
- |
if ( helper != mRootInstanceHelper ) |
61 |
|
- |
{ |
|
46 |
+ |
public synchronized void resetAllInstanceHelpers() { |
|
47 |
+ |
for ( InstanceHelper helper : mInstanceHelpersByFormDataRowKeys.values() ) { |
|
48 |
+ |
if ( helper != mRootInstanceHelper ) { |
62 |
49 |
|
helper.dispose(); |
63 |
50 |
|
} |
64 |
51 |
|
} |
65 |
52 |
|
mInstanceHelpersByFormDataRowKeys.clear(); |
66 |
|
- |
if ( mRootInstanceHelper != null ) |
67 |
|
- |
{ |
|
53 |
+ |
if ( mRootInstanceHelper != null ) { |
68 |
54 |
|
mRootInstanceHelper.resetSavedAttibuteValues(); |
69 |
55 |
|
mInstanceHelpersByFormDataRowKeys.put( mRootInstanceHelper.getFormDataRowKey(), |
70 |
56 |
|
mRootInstanceHelper ); |
71 |
57 |
|
} |
72 |
58 |
|
} |
73 |
59 |
|
|
74 |
|
- |
public synchronized void loadAllAttributeValues() |
75 |
|
- |
{ |
76 |
|
- |
if ( mRootInstanceHelper != null ) |
77 |
|
- |
{ |
|
60 |
+ |
public synchronized void loadAllAttributeValues() { |
|
61 |
+ |
if ( mRootInstanceHelper != null ) { |
78 |
62 |
|
mRootInstanceHelper.loadAllAttributeValues(); |
79 |
63 |
|
} |
80 |
64 |
|
} |
81 |
65 |
|
|
82 |
|
- |
public synchronized ArrayList<FormDataRowKey> getAllCurrentFormDataRowKeys() |
83 |
|
- |
{ |
|
66 |
+ |
public synchronized ArrayList<FormDataRowKey> getAllCurrentFormDataRowKeys() { |
84 |
67 |
|
return new ArrayList<FormDataRowKey>( mInstanceHelpersByFormDataRowKeys.keySet() ); |
85 |
68 |
|
} |
86 |
69 |
|
|
87 |
|
- |
public synchronized InstanceHelpersSnapShot getInstanceHelpers() |
88 |
|
- |
{ |
|
70 |
+ |
public synchronized InstanceHelpersSnapShot getInstanceHelpers() { |
89 |
71 |
|
return new InstanceHelpersSnapShot( mRootInstanceHelper, |
90 |
72 |
|
mInstanceHelpersByFormDataRowKeys.values().toArray( |
91 |
73 |
|
new InstanceHelper[mInstanceHelpersByFormDataRowKeys.size()] ) ); |
92 |
74 |
|
} |
93 |
75 |
|
|
94 |
|
- |
public synchronized InstanceHelper getInstanceHelper( FormDataRowKey pFormDataRowKey ) |
95 |
|
- |
{ |
|
76 |
+ |
public synchronized InstanceHelper getInstanceHelper( FormDataRowKey pFormDataRowKey ) { |
96 |
77 |
|
return (pFormDataRowKey == null) ? // null == Root |
97 |
78 |
|
getRootInstanceHelper() : // |
98 |
79 |
|
mInstanceHelpersByFormDataRowKeys.get( pFormDataRowKey ); |