|
@@ -1,71 +1,71 @@ |
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.io.*; |
5 |
|
- |
|
6 |
|
- |
public interface FormAttributeAdapter extends FormComponentAdapter { |
7 |
|
- |
public static final FormAttributeAdapter[] EMPTY_ARRAY = new FormAttributeAdapter[0]; |
8 |
|
- |
|
9 |
|
- |
public Integer getUniqueID(); |
10 |
|
- |
|
11 |
|
- |
String getAttributeReference(); |
12 |
|
- |
|
13 |
|
- |
boolean isErrorState(); |
14 |
|
- |
|
15 |
|
- |
String getErrorText(); |
16 |
|
- |
|
17 |
|
- |
/** |
18 |
|
- |
* @param pError if null means No Error |
19 |
|
- |
*/ |
20 |
|
- |
void setErrorText( String pError ); |
21 |
|
- |
|
22 |
|
- |
boolean isChangedState(); |
23 |
|
- |
|
24 |
|
- |
Serializable getBaseValue(); |
25 |
|
- |
|
26 |
|
- |
void setBaseValue( Serializable pBaseValue ); |
27 |
|
- |
|
28 |
|
- |
Serializable getCurrentValue(); |
29 |
|
- |
|
30 |
|
- |
void setCurrentValue( Serializable pCurrentValue ); |
31 |
|
- |
|
32 |
|
- |
String getUserValue(); |
33 |
|
- |
|
34 |
|
- |
void setUserValue( String pValue ); |
35 |
|
- |
|
36 |
|
- |
void publishAnyPendingChanges(); |
37 |
|
- |
|
38 |
|
- |
void updateValidOptions( Serializable[] pValidOptions ); |
39 |
|
- |
|
40 |
|
- |
interface BooleanValueAccessor { |
41 |
|
- |
boolean isBooleanValue( FormAttributeAdapter pAttributeAdapter ); |
42 |
|
- |
} |
43 |
|
- |
|
44 |
|
- |
public static final BooleanValueAccessor CHANGED = new BooleanValueAccessor() { |
45 |
|
- |
public boolean isBooleanValue( FormAttributeAdapter pAttributeAdapter ) { |
46 |
|
- |
return pAttributeAdapter.isChangedState(); |
47 |
|
- |
} |
48 |
|
- |
}; |
49 |
|
- |
|
50 |
|
- |
public static final BooleanValueAccessor ERRORED = new BooleanValueAccessor() { |
51 |
|
- |
public boolean isBooleanValue( FormAttributeAdapter pAttributeAdapter ) { |
52 |
|
- |
boolean error = pAttributeAdapter.isErrorState(); |
53 |
|
- |
if ( error ) { |
54 |
|
- |
LOGGER.trace.log( "HasError: ", pAttributeAdapter ); |
55 |
|
- |
} |
56 |
|
- |
return error; |
57 |
|
- |
} |
58 |
|
- |
}; |
59 |
|
- |
|
60 |
|
- |
public class Helper { |
61 |
|
- |
public static FormAttributeAdapter[] append( FormAttributeAdapter[] pOrig, FormAttributeAdapter pNew ) { |
62 |
|
- |
FormAttributeAdapter[] newArray = new FormAttributeAdapter[pOrig.length + 1]; |
63 |
|
- |
int i = 0; |
64 |
|
- |
for (; i < pOrig.length; i++ ) { |
65 |
|
- |
newArray[i] = pOrig[i]; |
66 |
|
- |
} |
67 |
|
- |
newArray[i] = pNew; |
68 |
|
- |
return newArray; |
69 |
|
- |
} |
70 |
|
- |
} |
71 |
|
- |
} |
|
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.io.*; |
|
5 |
+ |
|
|
6 |
+ |
public interface FormAttributeAdapter extends FormComponentAdapter { |
|
7 |
+ |
public static final FormAttributeAdapter[] EMPTY_ARRAY = new FormAttributeAdapter[0]; |
|
8 |
+ |
|
|
9 |
+ |
public Integer getUniqueID(); |
|
10 |
+ |
|
|
11 |
+ |
String getAttributeReference(); |
|
12 |
+ |
|
|
13 |
+ |
boolean isErrorState(); |
|
14 |
+ |
|
|
15 |
+ |
String getErrorText(); |
|
16 |
+ |
|
|
17 |
+ |
/** |
|
18 |
+ |
* @param pError if null means No Error |
|
19 |
+ |
*/ |
|
20 |
+ |
void setErrorText( String pError ); |
|
21 |
+ |
|
|
22 |
+ |
boolean isChangedState(); |
|
23 |
+ |
|
|
24 |
+ |
Serializable getBaseValue(); |
|
25 |
+ |
|
|
26 |
+ |
void setBaseValue( Serializable pBaseValue ); |
|
27 |
+ |
|
|
28 |
+ |
Serializable getCurrentValue(); |
|
29 |
+ |
|
|
30 |
+ |
void setCurrentValue( Serializable pCurrentValue ); |
|
31 |
+ |
|
|
32 |
+ |
String getUserValue(); |
|
33 |
+ |
|
|
34 |
+ |
void setUserValue( String pValue ); |
|
35 |
+ |
|
|
36 |
+ |
void publishAnyPendingChanges(); |
|
37 |
+ |
|
|
38 |
+ |
void updateValidOptions( Serializable[] pValidOptions ); |
|
39 |
+ |
|
|
40 |
+ |
interface BooleanValueAccessor { |
|
41 |
+ |
boolean isBooleanValue( FormAttributeAdapter pAttributeAdapter ); |
|
42 |
+ |
} |
|
43 |
+ |
|
|
44 |
+ |
public static final BooleanValueAccessor CHANGED = new BooleanValueAccessor() { |
|
45 |
+ |
public boolean isBooleanValue( FormAttributeAdapter pAttributeAdapter ) { |
|
46 |
+ |
return pAttributeAdapter.isChangedState(); |
|
47 |
+ |
} |
|
48 |
+ |
}; |
|
49 |
+ |
|
|
50 |
+ |
public static final BooleanValueAccessor ERRORED = new BooleanValueAccessor() { |
|
51 |
+ |
public boolean isBooleanValue( FormAttributeAdapter pAttributeAdapter ) { |
|
52 |
+ |
boolean error = pAttributeAdapter.isErrorState(); |
|
53 |
+ |
if ( error ) { |
|
54 |
+ |
LOGGER.trace.log( "HasError: ", pAttributeAdapter ); |
|
55 |
+ |
} |
|
56 |
+ |
return error; |
|
57 |
+ |
} |
|
58 |
+ |
}; |
|
59 |
+ |
|
|
60 |
+ |
public class Helper { |
|
61 |
+ |
public static FormAttributeAdapter[] append( FormAttributeAdapter[] pOrig, FormAttributeAdapter pNew ) { |
|
62 |
+ |
FormAttributeAdapter[] newArray = new FormAttributeAdapter[pOrig.length + 1]; |
|
63 |
+ |
int i = 0; |
|
64 |
+ |
for (; i < pOrig.length; i++ ) { |
|
65 |
+ |
newArray[i] = pOrig[i]; |
|
66 |
+ |
} |
|
67 |
+ |
newArray[i] = pNew; |
|
68 |
+ |
return newArray; |
|
69 |
+ |
} |
|
70 |
+ |
} |
|
71 |
+ |
} |