litesoft
@ HEAD
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 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
// This Source Code is in the Public Domain per: http://unlicense.org package org.litesoft.ui.def.nonpublic.support; import org.litesoft.commonfoundation.base.*; import org.litesoft.core.util.*; import org.litesoft.ui.def.nonpublic.*; import org.litesoft.ui.support.*; import java.util.*; public class FormMetaData implements UiMetaData { public static final long serialVersionUID = -7237653476576348111L; // Basic Base Form private String mRootType = null; // Basic Sub Form private String mRelAttributeRef = null; // Shared private Integer mUniqueID; private IntendedUse mIntendedUse; /** * @deprecated GWT ONLY */ public FormMetaData() { } public FormMetaData( FormUsage pUsage ) { mRootType = pUsage.getRootType(); mRelAttributeRef = pUsage.getRelAttributeRef(); mUniqueID = pUsage.getUniqueID(); mIntendedUse = pUsage.getIntendedUse(); } public Integer getUniqueID() { return mUniqueID; } public IntendedUse getIntendedUse() { return mIntendedUse; } public boolean isBaseForm() { return (getRootType() != null); } public String getRelAttributeRef() { return mRelAttributeRef; } public String getRootType() { return mRootType; } private Map<String, LabelMetaData> mLabels = new HashMap<String, LabelMetaData>(); public void addLabel( LabelMetaData pMetaData ) { if ( pMetaData != null ) { mLabels.put( pMetaData.getLabelID(), pMetaData ); } } public LabelMetaData getLabel( UiLabelSource pSource ) { return (pSource != null) ? (LabelMetaData) mLabels.get( pSource.getLabelID() ) : null; } private Map<String, ActionMetaData> mActions = new HashMap<String, ActionMetaData>(); public void addAction( ActionMetaData pMetaData ) { if ( pMetaData != null ) { mActions.put( pMetaData.getActionID(), pMetaData ); } } public ActionMetaData getAction( UiActionable pActionable ) { return (pActionable != null) ? getAction( pActionable.getActionID() ) : null; } public ActionMetaData getAction( String pActionID ) { return (pActionID != null) ? (ActionMetaData) mActions.get( pActionID ) : null; } private Map<Integer, AttributeMetaData> mAttributes = new HashMap<Integer, AttributeMetaData>(); public void addAttribute( AttributeMetaData pMetaData ) { if ( pMetaData != null ) { mAttributes.put( pMetaData.getUniqueID(), pMetaData ); } } public AttributeMetaData getAttribute( UiAttributeBacked pAttributeBacked ) { return (pAttributeBacked != null) ? // getAttribute( pAttributeBacked.getAttributeUniqueID() ) : // null; } public AttributeMetaData getAttribute( Integer pAttributeUniqueID ) { return (pAttributeUniqueID != null) ? // (AttributeMetaData) mAttributes.get( pAttributeUniqueID ) : // null; } private Map<Integer, FormMetaData> mRelSubForms = new HashMap<Integer, FormMetaData>(); public void addRelSubForm( FormMetaData pMetaData ) { if ( pMetaData != null ) { mRelSubForms.put( pMetaData.getUniqueID(), pMetaData ); } } public FormMetaData getRelSubForm( UiRelSubFormDef pRelSubFormDef ) { return (pRelSubFormDef != null) ? // (FormMetaData) mRelSubForms.get( pRelSubFormDef.getFormUniqueID() ) : // null; } public boolean equals( Object o ) { return (this == o) || ((o instanceof FormMetaData) && equals( (FormMetaData) o )); } public boolean equals( FormMetaData them ) { return (this == them) || // ((them != null) // && Currently.areEqual( this.mUniqueID, them.mUniqueID ) // && Currently.areEqual( this.mRootType, them.mRootType ) // && Currently.areEqual( this.mRelAttributeRef, them.mRelAttributeRef ) // ); } @Override public int hashCode() { return mUniqueID.hashCode(); } public int compareTo( FormMetaData pThem ) { Compare zCompare = isBaseForm() ? // Compare.first( this.getRootType(), pThem.getRootType() ) : // Compare.first( this.getRelAttributeRef(), pThem.getRelAttributeRef() ); zCompare = zCompare.then( this.getUniqueID(), pThem.getUniqueID() ); return zCompare.result(); } @Override public int compareTo( Object pObject ) { return compareTo( (FormMetaData) pObject ); } @Override public String toString() { return toStringBuilder( new StringBuilder().append( "FormMetaData-" ), 0 ).toString(); } @Override public StringBuilder toStringBuilder( StringBuilder pSB, int pDepth ) { if ( isBaseForm() ) { pSB.append( '@' ).append( mRootType ); } else { pSB.append( mRootType ).append( "->" ); } pSB.append( '(' ).append( mUniqueID ).append( ')' ); if ( anyChildren() ) { pSB.append( ":" ); int subDepth = pDepth + 1; if ( !mLabels.isEmpty() ) { add( pSB, subDepth, "Labels", mLabels.values() ); } if ( !mActions.isEmpty() ) { add( pSB, subDepth, "Actions", mActions.values() ); } if ( !mAttributes.isEmpty() ) { add( pSB, subDepth, "Attributes", mAttributes.values() ); } if ( !mRelSubForms.isEmpty() ) { add( pSB, subDepth, "RelSubForms", mRelSubForms.values() ); } } return pSB; } private boolean anyChildren() { return !mLabels.isEmpty() || !mActions.isEmpty() || !mAttributes.isEmpty() || !mRelSubForms.isEmpty(); } protected static void add( StringBuilder pSB, int pDepth, String pWhat, Collection pBuilders ) { ArrayList list = new ArrayList( pBuilders ); Collections.sort( list ); LineIndentUtil.newLine( pSB, pDepth++ ).append( pWhat ).append( ':' ); for ( int i = 0; i < list.size(); i++ ) { ToStringBuilder md = (ToStringBuilder) list.get( i ); md.toStringBuilder( LineIndentUtil.newLine( pSB, pDepth ), pDepth ); } } } |
Commits for litesoft/trunk/Java/core/jvm1.4/src/org/litesoft/ui/def/nonpublic/support/FormMetaData.java
Revision | Author | Commited | Message |
---|---|---|---|
950 Diff | GeorgeS | Thu 19 Jun, 2014 17:57:04 +0000 | New Lines |
948 Diff | GeorgeS | Sat 07 Jun, 2014 23:42:39 +0000 | Jusefuls Formatter Updated to New Code Format |
947 Diff | GeorgeS | Fri 06 Jun, 2014 23:36:56 +0000 | Correct Spelling of package! |
939 Diff | GeorgeS | Mon 02 Jun, 2014 21:30:31 +0000 | Extracting commonfoundation |
804 Diff | GeorgeS | Wed 15 Aug, 2012 12:48:51 +0000 | |
49 Diff | GeorgeS | Mon 12 Apr, 2010 02:59:10 +0000 | License Text |
2 | GeorgeS | Sun 07 Feb, 2010 12:50:58 +0000 |