litesoft
@ 939
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
// This Source Code is in the Public Domain per: http://litesoft.org/License.txt package org.litesoft.ui.def.nonpublic.support; import java.io.*; import org.litesoft.commonfoundation.typeutils.*; public class AttributeUpdateFormData implements Serializable { public static final AttributeUpdateFormData[] EMPTY_ARRAY = new AttributeUpdateFormData[0]; private FormDataRowKey mFormDataRowKey; private Integer mUniqueID; private String mAttributeReference; private Boolean mDisable = null; private String mErrorText = null; private boolean mHasValue = false; private Serializable mValue = null; /** * @deprecated GWT ONLY */ public AttributeUpdateFormData() { } public AttributeUpdateFormData( FormDataRowKey pFormDataRowKey, Integer pUniqueID, String pAttributeReference ) { mFormDataRowKey = pFormDataRowKey; mUniqueID = pUniqueID; mAttributeReference = Strings.noEmpty( pAttributeReference ); LLvalidate(); } public AttributeUpdateFormData( FormDataRowKey pFormDataRowKey, AttributeMetaData pAttributeMetaData ) { this( pFormDataRowKey, pAttributeMetaData.getUniqueID(), pAttributeMetaData.getAttributeReference() ); } protected void LLvalidate() { Objects.assertNotNull( "UniqueID", mUniqueID ); Objects.assertNotNull( "AttributeReference", mAttributeReference ); } public void validate() { LLvalidate(); if ( !mHasValue && (mDisable == null) && (mErrorText == null) ) { throw new IllegalStateException( "AttributeUpdate w/o Update" ); } } public AttributeUpdateFormData error( String pErrorText ) { mErrorText = Strings.noEmpty( pErrorText ); return this; } public AttributeUpdateFormData enable() { mDisable = Boolean.FALSE; return this; } public AttributeUpdateFormData disable() { mDisable = Boolean.TRUE; return this; } public AttributeUpdateFormData value( Serializable pValue ) { mHasValue = true; mValue = pValue; return this; } public FormDataRowKey getFormDataRowKey() { return mFormDataRowKey; } public Integer getUniqueID() { return mUniqueID; } public String getAttributeReference() { return mAttributeReference; } public Boolean getDisable() { return mDisable; } public String getErrorText() { return mErrorText; } public boolean hasValue() { return mHasValue; } public Serializable getValue() { return mValue; } public boolean isEnabled() { return Boolean.FALSE.equals( mDisable ); } public boolean isDisabled() { return Boolean.TRUE.equals( mDisable ); } public AttributeUpdateFormData copyForError( String error ) { return new AttributeUpdateFormData( mFormDataRowKey, mUniqueID, mAttributeReference ).error( error ); } public String toString() { return toStringBuilder( new StringBuilder().append( "AttributeUpdateFormData-" ), 0 ).toString(); } public StringBuilder toStringBuilder( StringBuilder pSB, int pDepth ) { pSB.append( "'" ).append( mAttributeReference ).append( "'" ); if ( mFormDataRowKey != null ) { pSB.append( '(' ); mFormDataRowKey.toStringBuilder( pSB, pDepth ); pSB.append( ')' ); } if ( (mDisable != null) || (mErrorText != null) ) { pSB.append( '[' ); if ( (mDisable != null) ) { pSB.append( mDisable.booleanValue() ? "Disabled" : "Enabled" ); if ( mErrorText != null ) { pSB.append( ',' ); } } if ( mErrorText != null ) { pSB.append( "Error='" ).append( mErrorText ).append( "'" ); } pSB.append( ']' ); } if ( mHasValue ) { pSB.append( '=' ).append( mValue ); } return pSB; } } |
Commits for litesoft/trunk/Java/core/jvm1.4/src/org/litesoft/ui/def/nonpublic/support/AttributeUpdateFormData.java
Revision | Author | Commited | Message |
---|---|---|---|
939 Diff | GeorgeS | Mon 02 Jun, 2014 21:30:31 +0000 | Extracting commonfoundation |
804 Diff | GeorgeS | Wed 15 Aug, 2012 12:48:51 +0000 | |
801 Diff | GeorgeS | Wed 15 Aug, 2012 03:59:02 +0000 | |
60 Diff | GeorgeS | Tue 24 Aug, 2010 00:37:36 +0000 | |
49 Diff | GeorgeS | Mon 12 Apr, 2010 02:59:10 +0000 | License Text |
2 | GeorgeS | Sun 07 Feb, 2010 12:50:58 +0000 |