Author: [EMAIL PROTECTED]
Date: Tue Dec 2 20:08:01 2008
New Revision: 4239
Modified:
branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/CalendarView.java
branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DatePicker.java
branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/ElementMapper.java
Log:
Addresses some of the remaining issues from
http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse_thread/thread/486babc9bb0863a9
In particular, nukes the unused Iterator class from ElementMapper,
fixes a bug in DatePicker#removeStyleFromVisibleDates, touches up some
javadoc, removes unneeded redeclaration of refresh from CalendarView.
We still lack unit tests on CalendarView and ElementMapper, and time
may not permit them. There is also a discussion in progress on
removeStyleFromVisibleDates. When that is done, any remaining methods
with Iterator in their signature will need to re-worked to use
Collection instead.
Modified:
branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/CalendarView.java
==============================================================================
---
branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/CalendarView.java
(original)
+++
branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/CalendarView.java
Tue Dec 2 20:08:01 2008
@@ -63,9 +63,6 @@
*/
public abstract boolean isDateEnabled(Date date);
- @Override
- public abstract void refresh();
-
/**
* Removes a visible style name from the cell of the supplied date.
*
Modified:
branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DatePicker.java
==============================================================================
---
branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DatePicker.java
(original)
+++
branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/DatePicker.java
Tue Dec 2 20:08:01 2008
@@ -380,7 +380,7 @@
}
/**
- * Gets the highlighted date, if any.
+ * Gets the highlighted date (the one the mouse is hovering over), if
any.
*
* @return the highlighted date
*/
@@ -399,9 +399,9 @@
}
/**
- * Gets the [EMAIL PROTECTED] DatePicker}'s value.
+ * Returns the selected date, or null if none is selected.
*
- * @return the value
+ * @return the selected date, or null
*/
public final Date getValue() {
return value;
@@ -456,7 +456,7 @@
assert (isDateVisible(date)) : date + " should be visible";
getView().removeStyleFromDate(styleName, date);
for (Date d : moreDates) {
- getView().removeStyleFromDate(styleName, date);
+ getView().removeStyleFromDate(styleName, d);
}
}
Modified:
branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/ElementMapper.java
==============================================================================
---
branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/ElementMapper.java
(original)
+++
branches/1_6_datepicker/user/src/com/google/gwt/user/datepicker/client/ElementMapper.java
Tue Dec 2 20:08:01 2008
@@ -17,13 +17,9 @@
package com.google.gwt.user.datepicker.client;
import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.ui.HTMLTable;
import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwt.user.client.ui.Widget;
import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
/**
* Creates a mapping from elements to their associated ui objects.
@@ -99,57 +95,6 @@
public void removeByElement(Element elem) {
int index = getIndex(elem);
removeImpl(elem, index);
- }
-
- /**
- * Creates an iterator of uiObjects.
- *
- * @return the iterator
- */
- public Iterator<T> iterator() {
-
- return new Iterator<T>() {
- int lastIndex = -1;
- int nextIndex = -1;
- {
- findNext();
- }
-
- public boolean hasNext() {
- return nextIndex < uiObjectList.size();
- }
-
- public T next() {
- if (!hasNext()) {
- throw new NoSuchElementException();
- }
- T result = uiObjectList.get(nextIndex);
- lastIndex = nextIndex;
- findNext();
- return result;
- }
-
- public void remove() {
- if (lastIndex < 0) {
- throw new IllegalStateException();
- }
- // TODO(ecc) Why are we casting to Widget and working only in
tables?
- // Is this code even executed? If not, let's yank it
- // and throwing an UnsupportedOperationException
- Widget w = (Widget) uiObjectList.get(lastIndex);
- assert (w.getParent() instanceof HTMLTable);
- w.removeFromParent();
- lastIndex = -1;
- }
-
- private void findNext() {
- while (++nextIndex < uiObjectList.size()) {
- if (uiObjectList.get(nextIndex) != null) {
- return;
- }
- }
- }
- };
}
private void removeImpl(Element elem, int index) {
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---