cmu.survey.editor.data.sql
Class ChoicesDataBitSetSQL

java.lang.Object
  extended by org.browsecode.helpers.reorderablelistpanel.ReorderableListModelWithOrderIndexStub<OneChoiceDataBitSet>
      extended by cmu.survey.editor.data.sql.ChoicesDataBitSetSQL
All Implemented Interfaces:
ChoicesDataBitSet, DataBitSet, Copyable, Moveable, ReorderableListModel<OneChoiceDataBitSet>

public class ChoicesDataBitSetSQL
extends ReorderableListModelWithOrderIndexStub<OneChoiceDataBitSet>
implements ChoicesDataBitSet, Copyable, Moveable


Nested Class Summary
 class ChoicesDataBitSetSQL.ReorderableChoice
           
 
Nested classes/interfaces inherited from class org.browsecode.helpers.reorderablelistpanel.ReorderableListModelWithOrderIndexStub
ReorderableListModelWithOrderIndexStub.ReorderableObject<E2>
 
Field Summary
protected  java.util.Vector<ReorderableListModelWithOrderIndexStub.ReorderableObject<OneChoiceDataBitSet>> choices
           
 
Fields inherited from class org.browsecode.helpers.reorderablelistpanel.ReorderableListModelWithOrderIndexStub
ABSTRACTION_ERROR, undoableEditListeners
 
Fields inherited from interface org.browsecode.helpers.reorderablelistpanel.ReorderableListModel
INSERTED_FROM_DELETED_HERE, INSERTED_FROM_ELSEWHERE
 
Constructor Summary
ChoicesDataBitSetSQL(CopyingNumberDataBit questionIDLoadedFrom, StringDataBit type, IntegerDataBit numberOfChoices, DataBitStorageSQL theLoader)
           
 
Method Summary
 boolean canItemBeMovedElsewhere()
          Removed means can it be moved to somewhere else, NOT deleted -- it must always be deletable.
 ChoicesDataBitSetSQL copyTo(AuxillaryQuestionPartSQLStub parentPart)
           
 java.lang.Object copyTo(java.lang.Object parent)
          Make a copy for use in the new parent.
 ChoicesDataBitSetSQL copyTo(QuestionDataBitSetSQL parentQuestion)
           
protected  void deleteItem(ReorderableListModelWithOrderIndexStub.ReorderableObject<OneChoiceDataBitSet> justDeleted)
          If an object is deleted from the list, this method is fired and should be used to keep track of which items should not be saved anymore and deleted when this set is saved.
 boolean equals(java.lang.Object compareMe)
           
protected  void fireUndoableEdit(javax.swing.undo.UndoableEdit edit)
           
 IntegerDataBit getCacheRandomizeOrder()
           
 java.util.Vector<OneChoiceDataBitSet> getChoices()
          DO NOT modify the Vector after you get it!
protected  java.lang.String getItemsName()
          For undos and presentation names -- so we can say what we're moving/deleting/inserting
protected  java.util.Vector<ReorderableListModelWithOrderIndexStub.ReorderableObject<OneChoiceDataBitSet>> getItemsVector()
          Should return a non-cloned version of the list of items -- the vector will be changed to reflect the order, etc.
 java.util.Vector<OneChoiceDataBitSet> getNewChoicesCopy()
           
 OneChoiceDataBitSet getNewItem()
          Creates a new item for the list, but does not insert it into the list.
 IntegerDataBit getNumberOfChoices()
          The number of scale choices there are (i.e. this number shows whether it's 1-3 or 1-5, etc).
 IntegerDataBit getNumberOfChoicesDontThrowError()
          The same as getNumberOfChoices() but it ignores whether or not it's a CHOICE_SCALE -- only use this if you want to know what the choices are when you know it's a CHOICE_LIST
 int getNumQuestionsUsingThisSet()
           
 IntegerDataBit getRandomizeOrder()
           
protected  ReorderableListModelWithOrderIndexStub.ReorderableObject<OneChoiceDataBitSet> getReorderableObjectFor(OneChoiceDataBitSet reorderableItem)
           
 StringDataBit getType()
           
 boolean hasBeenModified()
           
 Moveable moveTo(java.lang.Object newParent)
          Move to the new parent.
 ChoicesDataBitSetSQL moveTo(QuestionDataBitSetSQL newParent)
           
 boolean save()
           
 void setNumQuestionsUsingThisSet(int i)
           
 boolean shouldFireUndoableEdits()
          Also public for other classes that want to use the same list of undoableEditListeners.
 java.lang.String toString()
           
protected  boolean undeleteItem(ReorderableListModelWithOrderIndexStub.ReorderableObject<OneChoiceDataBitSet> aboutToUndelete)
          Undelete an item that was just deleted using deleteItem().
 
Methods inherited from class org.browsecode.helpers.reorderablelistpanel.ReorderableListModelWithOrderIndexStub
addReorderableChangeListener, addUndoableEditListener, deleteItem, deleteItemProtected, fireUndoableEdit, getHasBeenChanged, getItemCount, getNewItem, getVectorOfReorderableItems, insertNewItemAt, insertNewItemAtProtected, iterator, moveItemElsewhere, moveItemElsewhereProtected, moveItemToIndex, moveItemToIndexProtected, removeReorderableChangeListener, removeUndoableEditListener, resetHasBeenChanged, setCachedReorderableItems
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.browsecode.helpers.reorderablelistpanel.ReorderableListModel
addReorderableChangeListener, deleteItem, getItemCount, insertNewItemAt, iterator, moveItemElsewhere, moveItemToIndex, removeReorderableChangeListener
 

Field Detail

choices

protected java.util.Vector<ReorderableListModelWithOrderIndexStub.ReorderableObject<OneChoiceDataBitSet>> choices
Constructor Detail

ChoicesDataBitSetSQL

public ChoicesDataBitSetSQL(CopyingNumberDataBit questionIDLoadedFrom,
                            StringDataBit type,
                            IntegerDataBit numberOfChoices,
                            DataBitStorageSQL theLoader)
Method Detail

save

public boolean save()

hasBeenModified

public boolean hasBeenModified()
Specified by:
hasBeenModified in interface DataBitSet
Returns:
whether the question has been modified since load or if it is new. Basically, it returns whether this DataBitSet needs to be saved.

getChoices

public java.util.Vector<OneChoiceDataBitSet> getChoices()
DO NOT modify the Vector after you get it! All modifications should be done through calls to ChoicesDataBitSet, not to the Vector. Changes made to the Vector will not affect this class.

Specified by:
getChoices in interface ChoicesDataBitSet
Returns:

getNumQuestionsUsingThisSet

public int getNumQuestionsUsingThisSet()
Specified by:
getNumQuestionsUsingThisSet in interface ChoicesDataBitSet
Returns:

setNumQuestionsUsingThisSet

public void setNumQuestionsUsingThisSet(int i)
Parameters:
i -

getItemsName

protected java.lang.String getItemsName()
Description copied from class: ReorderableListModelWithOrderIndexStub
For undos and presentation names -- so we can say what we're moving/deleting/inserting

Overrides:
getItemsName in class ReorderableListModelWithOrderIndexStub<OneChoiceDataBitSet>

getItemsVector

protected java.util.Vector<ReorderableListModelWithOrderIndexStub.ReorderableObject<OneChoiceDataBitSet>> getItemsVector()
Description copied from class: ReorderableListModelWithOrderIndexStub
Should return a non-cloned version of the list of items -- the vector will be changed to reflect the order, etc.

Overrides:
getItemsVector in class ReorderableListModelWithOrderIndexStub<OneChoiceDataBitSet>
Returns:
Vector

deleteItem

protected void deleteItem(ReorderableListModelWithOrderIndexStub.ReorderableObject<OneChoiceDataBitSet> justDeleted)
Description copied from class: ReorderableListModelWithOrderIndexStub
If an object is deleted from the list, this method is fired and should be used to keep track of which items should not be saved anymore and deleted when this set is saved.

Overrides:
deleteItem in class ReorderableListModelWithOrderIndexStub<OneChoiceDataBitSet>

undeleteItem

protected boolean undeleteItem(ReorderableListModelWithOrderIndexStub.ReorderableObject<OneChoiceDataBitSet> aboutToUndelete)
Description copied from class: ReorderableListModelWithOrderIndexStub
Undelete an item that was just deleted using deleteItem(). Return true if it works and is implemented, return false if it doesn't work or isn't implemented. Implemented for now as a convenience to those who

Overrides:
undeleteItem in class ReorderableListModelWithOrderIndexStub<OneChoiceDataBitSet>

getNewItem

public OneChoiceDataBitSet getNewItem()
Description copied from class: ReorderableListModelWithOrderIndexStub
Creates a new item for the list, but does not insert it into the list. Required for getNewItem(int), which does the job correctly if you implement this.;

Overrides:
getNewItem in class ReorderableListModelWithOrderIndexStub<OneChoiceDataBitSet>
Returns:

canItemBeMovedElsewhere

public boolean canItemBeMovedElsewhere()
Description copied from interface: ReorderableListModel
Removed means can it be moved to somewhere else, NOT deleted -- it must always be deletable.

Specified by:
canItemBeMovedElsewhere in interface ReorderableListModel<OneChoiceDataBitSet>
Overrides:
canItemBeMovedElsewhere in class ReorderableListModelWithOrderIndexStub<OneChoiceDataBitSet>
Returns:
whether or not this item can be moved to another location. False if it cannot be moved to another location.

equals

public boolean equals(java.lang.Object compareMe)
Overrides:
equals in class java.lang.Object

copyTo

public ChoicesDataBitSetSQL copyTo(QuestionDataBitSetSQL parentQuestion)

copyTo

public ChoicesDataBitSetSQL copyTo(AuxillaryQuestionPartSQLStub parentPart)

copyTo

public java.lang.Object copyTo(java.lang.Object parent)
Description copied from interface: Copyable
Make a copy for use in the new parent. If the new parent (i.e. the ReorderableListPanel) implements HasData, it will call this method with that data -- i.e. oldCopy.copyTo(futureParentReorderableListItemPanel.getData());

Specified by:
copyTo in interface Copyable
Returns:

getNewChoicesCopy

public java.util.Vector<OneChoiceDataBitSet> getNewChoicesCopy()
Specified by:
getNewChoicesCopy in interface ChoicesDataBitSet

moveTo

public ChoicesDataBitSetSQL moveTo(QuestionDataBitSetSQL newParent)

moveTo

public Moveable moveTo(java.lang.Object newParent)
Description copied from interface: Moveable
Move to the new parent. If the new parent (i.e. the ReorderableListPanel) implements HasData, it will call this method with that data -- i.e. objectToMove.moveTo(futureParentReorderableListItemPanel.getData());

Specified by:
moveTo in interface Moveable
Returns:

getType

public StringDataBit getType()
Specified by:
getType in interface ChoicesDataBitSet

getNumberOfChoices

public IntegerDataBit getNumberOfChoices()
Description copied from interface: ChoicesDataBitSet
The number of scale choices there are (i.e. this number shows whether it's 1-3 or 1-5, etc). This should only be called when the choices type is CHOICE_SCALE.

Specified by:
getNumberOfChoices in interface ChoicesDataBitSet
Returns:

getNumberOfChoicesDontThrowError

public IntegerDataBit getNumberOfChoicesDontThrowError()
Description copied from interface: ChoicesDataBitSet
The same as getNumberOfChoices() but it ignores whether or not it's a CHOICE_SCALE -- only use this if you want to know what the choices are when you know it's a CHOICE_LIST

Specified by:
getNumberOfChoicesDontThrowError in interface ChoicesDataBitSet
Returns:

getRandomizeOrder

public IntegerDataBit getRandomizeOrder()
Specified by:
getRandomizeOrder in interface ChoicesDataBitSet

getCacheRandomizeOrder

public IntegerDataBit getCacheRandomizeOrder()
Specified by:
getCacheRandomizeOrder in interface ChoicesDataBitSet

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getReorderableObjectFor

protected ReorderableListModelWithOrderIndexStub.ReorderableObject<OneChoiceDataBitSet> getReorderableObjectFor(OneChoiceDataBitSet reorderableItem)
Overrides:
getReorderableObjectFor in class ReorderableListModelWithOrderIndexStub<OneChoiceDataBitSet>

shouldFireUndoableEdits

public boolean shouldFireUndoableEdits()
Description copied from class: ReorderableListModelWithOrderIndexStub
Also public for other classes that want to use the same list of undoableEditListeners.

Overrides:
shouldFireUndoableEdits in class ReorderableListModelWithOrderIndexStub<OneChoiceDataBitSet>

fireUndoableEdit

protected void fireUndoableEdit(javax.swing.undo.UndoableEdit edit)
Overrides:
fireUndoableEdit in class ReorderableListModelWithOrderIndexStub<OneChoiceDataBitSet>