cmu.survey.editor.data.table
Class PageTable

java.lang.Object
  extended by org.browsecode.helpers.reorderablelistpanel.ReorderableListModelWithOrderIndexStub<QuestionDataBitSet>
      extended by cmu.survey.editor.data.table.PageTable
All Implemented Interfaces:
Page, HasID, Copyable, Moveable, ReorderableListModel<QuestionDataBitSet>
Direct Known Subclasses:
PageSQL

public class PageTable
extends ReorderableListModelWithOrderIndexStub<QuestionDataBitSet>
implements Page, HasID, Copyable, Moveable


Nested Class Summary
 class PageTable.ReorderableTableQuestion
           
 
Nested classes/interfaces inherited from class org.browsecode.helpers.reorderablelistpanel.ReorderableListModelWithOrderIndexStub
ReorderableListModelWithOrderIndexStub.ReorderableObject<E2>
 
Field Summary
protected  StringDataBit answersTable
           
protected  java.util.Vector<ReorderableListModelWithOrderIndexStub.ReorderableObject<QuestionDataBitSet>> deletedQuestions
           
protected  StringDataBit name
           
protected  IntegerDataBit orderIndex
           
protected  IntegerDataBit pageNum
           
protected  DataTableModel pageTableModel
           
protected  java.util.Vector<ReorderableListModelWithOrderIndexStub.ReorderableObject<QuestionDataBitSet>> questions
           
protected  StringDataBit repeatedMeasure
           
protected  StringDataBit submitButtonLabel
           
protected  DataBitStorageTable tableStorage
           
 
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
PageTable(java.lang.Integer pageNumber, DataBitStorageTable storage)
           
PageTable(java.lang.Integer pageNumber, DataBitStorageTable storage, java.lang.Integer orderIndex, java.lang.String name, java.lang.String answersTable, java.lang.String submitButtonLabel, java.lang.String repeatedMeasure)
           
 
Method Summary
 java.lang.Object copyTo(java.lang.Object newParent)
          Make a copy for use in the new parent.
 PageTable copyTo(SurveyTable parentSurvey)
           
protected  void deleteItem(ReorderableListModelWithOrderIndexStub.ReorderableObject<QuestionDataBitSet> 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.
protected  void fireUndoableEdit(javax.swing.undo.UndoableEdit edit)
           
protected  java.util.Vector<DataBit> getDataBits()
           
 java.lang.Integer getID()
           
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<QuestionDataBitSet>> getItemsVector()
          Should return a non-cloned version of the list of items -- the vector will be changed to reflect the order, etc.
 StringDataBit getName()
           
 QuestionDataBitSet getNewItem()
          Creates a new item for the list, but does not insert it into the list.
protected  ReorderableListModelWithOrderIndexStub.ReorderableObject<QuestionDataBitSet> getNewItem(int indexAt)
          Overridden in order to add scales below scale headers and scales automatically.
 IntegerDataBit getOrderIndex()
           
 IntegerDataBit getPageID()
           
 java.util.Vector getQuestions()
          Get a Vector of QuestionDataBitSet, the questions on the page.
protected  ReorderableListModelWithOrderIndexStub.ReorderableObject<QuestionDataBitSet> getReorderableObjectFor(QuestionDataBitSet reorderableItem)
           
protected  ReorderableListModelWithOrderIndexStub.ReorderableObject<QuestionDataBitSet> getReorderableObjectFor(QuestionDataBitSet reorderableItem, java.lang.Integer orderIndex, java.lang.Integer uniqueRowId)
           
 StringDataBit getRepeatedMeasureTable()
          Get the name of the table with the repeated measures in it, if there is a table with the repeated measures in it.
 StringDataBit getSubmitButtonLabel()
           
 StringDataBit getTableName()
           
 boolean hasBeenModified()
           
 boolean hasBeenModifiedWithoutQuestions()
           
 boolean isNew()
           
protected  void loadQuestionsIfNecessary()
           
 boolean moveItemElsewhere(QuestionDataBitSet item, int oldIndex)
          Removed means it was moved to somewhere else, NOT deleted.
 Moveable moveTo(java.lang.Object newParent)
          Move to the new parent.
 PageTable moveTo(SurveyTable parentSurvey)
           
 boolean save()
           
 boolean saveDeletePage()
          Call when saving to delete the page
 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<QuestionDataBitSet> aboutToUndelete)
          Undelete an item that was just deleted using deleteItem().
 
Methods inherited from class org.browsecode.helpers.reorderablelistpanel.ReorderableListModelWithOrderIndexStub
addReorderableChangeListener, addUndoableEditListener, canItemBeMovedElsewhere, deleteItem, deleteItemProtected, fireUndoableEdit, getHasBeenChanged, getItemCount, getVectorOfReorderableItems, insertNewItemAt, insertNewItemAtProtected, iterator, moveItemElsewhereProtected, moveItemToIndex, moveItemToIndexProtected, removeReorderableChangeListener, removeUndoableEditListener, resetHasBeenChanged, setCachedReorderableItems
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.browsecode.helpers.reorderablelistpanel.ReorderableListModel
addReorderableChangeListener, canItemBeMovedElsewhere, deleteItem, getItemCount, insertNewItemAt, iterator, moveItemToIndex, removeReorderableChangeListener
 

Field Detail

questions

protected java.util.Vector<ReorderableListModelWithOrderIndexStub.ReorderableObject<QuestionDataBitSet>> questions

tableStorage

protected DataBitStorageTable tableStorage

deletedQuestions

protected java.util.Vector<ReorderableListModelWithOrderIndexStub.ReorderableObject<QuestionDataBitSet>> deletedQuestions

pageNum

protected IntegerDataBit pageNum

orderIndex

protected IntegerDataBit orderIndex

name

protected StringDataBit name

answersTable

protected StringDataBit answersTable

submitButtonLabel

protected StringDataBit submitButtonLabel

repeatedMeasure

protected StringDataBit repeatedMeasure

pageTableModel

protected DataTableModel pageTableModel
Constructor Detail

PageTable

public PageTable(java.lang.Integer pageNumber,
                 DataBitStorageTable storage)

PageTable

public PageTable(java.lang.Integer pageNumber,
                 DataBitStorageTable storage,
                 java.lang.Integer orderIndex,
                 java.lang.String name,
                 java.lang.String answersTable,
                 java.lang.String submitButtonLabel,
                 java.lang.String repeatedMeasure)
Method Detail

loadQuestionsIfNecessary

protected void loadQuestionsIfNecessary()

getDataBits

protected java.util.Vector<DataBit> getDataBits()

save

public boolean save()
Specified by:
save in interface Page

saveDeletePage

public boolean saveDeletePage()
Call when saving to delete the page


hasBeenModifiedWithoutQuestions

public boolean hasBeenModifiedWithoutQuestions()

hasBeenModified

public boolean hasBeenModified()
Specified by:
hasBeenModified in interface Page

getName

public StringDataBit getName()
Specified by:
getName in interface Page

getTableName

public StringDataBit getTableName()
Specified by:
getTableName in interface Page

getSubmitButtonLabel

public StringDataBit getSubmitButtonLabel()
Specified by:
getSubmitButtonLabel in interface Page

getRepeatedMeasureTable

public StringDataBit getRepeatedMeasureTable()
Description copied from interface: Page
Get the name of the table with the repeated measures in it, if there is a table with the repeated measures in it.

Specified by:
getRepeatedMeasureTable in interface Page
Returns:

isNew

public boolean isNew()
Specified by:
isNew in interface Page

toString

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

getQuestions

public java.util.Vector getQuestions()
Description copied from interface: Page
Get a Vector of QuestionDataBitSet, the questions on the page.

Specified by:
getQuestions in interface Page

getItemsVector

protected java.util.Vector<ReorderableListModelWithOrderIndexStub.ReorderableObject<QuestionDataBitSet>> 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<QuestionDataBitSet>
Returns:
Vector

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<QuestionDataBitSet>

getNewItem

protected ReorderableListModelWithOrderIndexStub.ReorderableObject<QuestionDataBitSet> getNewItem(int indexAt)
Overridden in order to add scales below scale headers and scales automatically. Really, this is a gui feature and probably shouldn't be here, precisely...

Overrides:
getNewItem in class ReorderableListModelWithOrderIndexStub<QuestionDataBitSet>

moveItemElsewhere

public boolean moveItemElsewhere(QuestionDataBitSet item,
                                 int oldIndex)
Description copied from interface: ReorderableListModel
Removed means it was moved to somewhere else, NOT deleted.

Specified by:
moveItemElsewhere in interface ReorderableListModel<QuestionDataBitSet>
Overrides:
moveItemElsewhere in class ReorderableListModelWithOrderIndexStub<QuestionDataBitSet>
Returns:
true if it happened, false if it did not happen. If this returns false, it either means that (a) canItemBeMovedElsewhere() should have been called, and it would return false, or (b) if canItemBeMovedElsewhere() returned true, then the call didn't work.

deleteItem

protected void deleteItem(ReorderableListModelWithOrderIndexStub.ReorderableObject<QuestionDataBitSet> 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<QuestionDataBitSet>

undeleteItem

protected boolean undeleteItem(ReorderableListModelWithOrderIndexStub.ReorderableObject<QuestionDataBitSet> 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<QuestionDataBitSet>

getNewItem

public QuestionDataBitSet 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<QuestionDataBitSet>
Returns:

getOrderIndex

public IntegerDataBit getOrderIndex()

getPageID

public IntegerDataBit getPageID()
Specified by:
getPageID in interface Page

getID

public java.lang.Integer getID()
Specified by:
getID in interface HasID
Returns:
0 or -1 if it has no id or hasn't been set yet, and anything higher than that is the integer ID.

getReorderableObjectFor

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

getReorderableObjectFor

protected ReorderableListModelWithOrderIndexStub.ReorderableObject<QuestionDataBitSet> getReorderableObjectFor(QuestionDataBitSet reorderableItem,
                                                                                                               java.lang.Integer orderIndex,
                                                                                                               java.lang.Integer uniqueRowId)

moveTo

public PageTable moveTo(SurveyTable parentSurvey)

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:

copyTo

public PageTable copyTo(SurveyTable parentSurvey)

copyTo

public java.lang.Object copyTo(java.lang.Object newParent)
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:

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<QuestionDataBitSet>

fireUndoableEdit

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