litesoft
@ 787
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 |
// This Source Code is in the Public Domain per: http://litesoft.org/License.txt package org.litesoft.aokeyhole.objects; import java.util.*; public abstract class AttributeSet { public static final int SORT_ID = -100; public static final int SORT_BridgeToOneLeft = -51; public static final int SORT_PairedToOne = -50; public static final int SORT_BridgeToOneRight = -49; public static final int SORT_ToMany = 50; private int mSortIndex; private AttributeType mType; private ASet mPersisted, mVirtual; protected AttributeSet( int pSortIndex, AttributeType pType, ASet pPersisted, ASet pVirtual ) { mSortIndex = pSortIndex; mType = pType; mPersisted = pPersisted; mVirtual = pVirtual; } protected AttributeSet( AttributeType pType, ASet pPersisted, ASet pVirtual ) { this( 0, pType, pPersisted, pVirtual ); } protected AttributeSet( int pSortIndex, AttributeType pType, ASet pPersisted ) { this( pSortIndex, pType, pPersisted, null ); } protected AttributeSet( AttributeType pType, ASet pPersisted ) { this( 0, pType, pPersisted, null ); } public int getSortIndex() { return mSortIndex; } public AttributeType getType() { return mType; } abstract public boolean isUiCreatable(); abstract public boolean isUiDeleteable(); public ASet getPersisted() { return mPersisted; } public ASet getVirtual() { return mVirtual; } public boolean isNameEditable() { return true; } public void addTypeOptions( List<String> pTypes ) { String zType = mType.toString(); if ( mPersisted != null ) { pTypes.add( zType ); } if ( mVirtual != null ) { pTypes.add( zType + " (virtual)" ); } } public boolean isAcceptableAsRelatedTo( ObjectMetaData pObjectMetaData, boolean pVirtual ) { ASet zASet = pVirtual ? getVirtual() : getPersisted(); return zASet.isAcceptableAsRelatedTo( pObjectMetaData ); } } |