Skip to content

Commit

Permalink
some javadoc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
darkv committed Apr 24, 2012
1 parent 1d8b0be commit 0b2fc72
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* <ul>
* <li>provide access to the filtered objects</li>
* <li>allows you to add qualifiers to the final query qualifier (as opposed to just min/equals/max with the keys)</li>
* <li>clears out the sort ordering when the datasource changes. This is a cure fix to prevent errors when using switch components.
* <li>clears out the sort ordering when the datasource changes. This is a cure fix to prevent errors when using switch components.</li>
* </ul>
* @author ak
* @param <T>
Expand Down Expand Up @@ -91,6 +91,7 @@ public void setQualifierForKey(EOQualifier qualifier, String key) {

/**
* Overridden to support extra qualifiers.
* @return the qualifier constructed
*/
@Override
public EOQualifier qualifierFromQueryValues() {
Expand All @@ -106,6 +107,7 @@ public EOQualifier qualifierFromQueryValues() {

/**
* Overridden to localize the fetch specification if needed.
* @return <code>null</code> to force the page to reload
*/
@Override
public Object fetch() {
Expand Down Expand Up @@ -136,8 +138,8 @@ public Object fetch() {

/**
* Returns all objects, filtered by the qualifier().
* @return filtered objects
*/
@SuppressWarnings("unchecked")
public NSArray<T> filteredObjects() {
// FIXME AK: need to cache here
NSArray<T> result;
Expand All @@ -152,40 +154,29 @@ public NSArray<T> filteredObjects() {

/**
* Returns allObjects(), first filtered by the qualifier(), then sorted by the sortOrderings().
* @return sorted filtered objects
*/
public NSArray<T> sortedObjects() {
return ERXS.sorted(filteredObjects(), sortOrderings());
}

/**
* Overridden to track selection changes.
*/
@Override
@SuppressWarnings("unchecked")
public NSArray<T> selectedObjects() {
if(log.isDebugEnabled()) {
log.debug("selectedObjects@" + hashCode() + ":" + super.selectedObjects().count());
}
return super.selectedObjects();
}

/**
* Overridden to track selection changes.
*/
@Override
@SuppressWarnings("unchecked")
public void setSelectedObjects(NSArray nsarray) {
if(log.isDebugEnabled()) {
log.debug("setSelectedObjects@" + hashCode() + ":" + (nsarray != null ? nsarray.count() : "0"));
}
super.setSelectedObjects(nsarray);
}

/**
* Overridden to track selection changes.
*/
@Override
@SuppressWarnings("unchecked")
public boolean setSelectionIndexes(NSArray nsarray) {
if(log.isDebugEnabled()) {
log.debug("setSelectionIndexes@" + hashCode() + ":" + (nsarray != null ? nsarray.count() : "0"),
Expand Down Expand Up @@ -252,29 +243,32 @@ public boolean removeFromSelection(NSArray<T> objects) {
}

/**
* Overriden to re-set the selection. Why is this cleared in the super class?
* Overridden to preserve the current selection.
* @param count the proposed number of objects the WODisplayGroup should display at a time
*/
@Override
public void setNumberOfObjectsPerBatch(int i) {
public void setNumberOfObjectsPerBatch(int count) {
NSArray<T> oldSelection = selectedObjects();
super.setNumberOfObjectsPerBatch(i);
super.setNumberOfObjectsPerBatch(count);
setSelectedObjects(oldSelection);
}

/**
* Overridden to clear out the sort ordering if it is no longer applicable.
* @param ds the proposed EODataSource
*/
@Override
public void setDataSource(EODataSource eodatasource) {
public void setDataSource(EODataSource ds) {
EODataSource old = dataSource();
super.setDataSource(eodatasource);
if(old != null && eodatasource != null && ERXExtensions.safeDifferent(old.classDescriptionForObjects(), eodatasource.classDescriptionForObjects())) {
super.setDataSource(ds);
if(old != null && ds != null && ERXExtensions.safeDifferent(old.classDescriptionForObjects(), ds.classDescriptionForObjects())) {
setSortOrderings(NSArray.EmptyArray);
}
}

/**
* Overriden to re-set the selection. Why is this cleared in the super class?
* Overridden to preserve the current selection.
* @return <code>null</code> to force the page to reload
*/
@Override
public Object displayNextBatch() {
Expand All @@ -285,7 +279,8 @@ public Object displayNextBatch() {
}

/**
* Overriden to re-set the selection. Why is this cleared in the super class?
* Overridden to preserve the current selection.
* @return <code>null</code> to force the page to reload
*/
@Override
public Object displayPreviousBatch() {
Expand All @@ -297,7 +292,7 @@ public Object displayPreviousBatch() {

/**
* Selects the visible objects.
*
* @return <code>null</code> to force the page to reload
*/
public Object selectFilteredObjects() {
setSelectedObjects(filteredObjects());
Expand All @@ -306,9 +301,9 @@ public Object selectFilteredObjects() {

/**
* Overridden to log a message when more than one sort order exists. Useful to track down errors.
* @param nsarray the proposed EOSortOrdering objects
*/
@Override
@SuppressWarnings("unchecked")
public void setSortOrderings(NSArray nsarray) {
super.setSortOrderings(nsarray);
if(nsarray != null && nsarray.count() > 1) {
Expand All @@ -324,55 +319,35 @@ public void clearExtraQualifiers() {

/* Generified methods */

/**
* Overridden to return generic types
*/
@Override
@SuppressWarnings("unchecked")
public NSArray<T> allObjects() {
return super.allObjects();
}

/**
* Overridden to return generic types
*/
@Override
@SuppressWarnings("unchecked")
public NSArray<String> allQualifierOperators() {
return super.allQualifierOperators();
}

/**
* Overridden to return generic types
*/
@Override
@SuppressWarnings("unchecked")
public NSArray<T> displayedObjects() {
return super.displayedObjects();
}

/**
* Overridden to return generic types
*/
@Override
@SuppressWarnings("unchecked")
public T selectedObject() {
return (T) super.selectedObject();
}

/**
* Overridden to return generic types
*/
@Override
@SuppressWarnings("unchecked")
public NSArray<EOSortOrdering> sortOrderings() {
return super.sortOrderings();
}

/**
* Overridden to return correct result when no objects are displayed
* @return the index of the first object displayed by the current batch
*/

@Override
public int indexOfFirstDisplayedObject() {
if (currentBatchIndex() == 1 && displayedObjects().count() == 0)
Expand All @@ -385,6 +360,7 @@ public int indexOfFirstDisplayedObject() {
* is not a multiple of <code>numberOfObjectsPerBatch</code> and we are
* on the last batch index. The superclass incorrectly uses allObjects
* instead of displayedObjects to determine the index value.
* @return the index of the last object displayed by the current batch
*/
@Override
public int indexOfLastDisplayedObject() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void setNumberOfObjectsPerBatch(int count) {
* would always fetch from the start until the end of the objects from the
* fetch limit.
*
* @return the objects that should be diplayed.
* @return the objects that should be displayed.
*/
@Override
public NSArray<T> displayedObjects() {
Expand Down

0 comments on commit 0b2fc72

Please sign in to comment.