diff options
Diffstat (limited to 'projects/net.wotonomy.ui')
4 files changed, 21 insertions, 19 deletions
diff --git a/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/DebuggingDelegate.java b/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/DebuggingDelegate.java index 3512c2a..a09df1e 100644 --- a/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/DebuggingDelegate.java +++ b/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/DebuggingDelegate.java @@ -101,7 +101,7 @@ public class DebuggingDelegate implements EODisplayGroup.Delegate { * @return An NSArray containing the objects to be displayed for the objects in * the specified list. */ - public NSArray displayGroupDisplayArrayForObjects(EODisplayGroup aDisplayGroup, List aList) { + public <T> NSArray<T> displayGroupDisplayArrayForObjects(EODisplayGroup aDisplayGroup, List<T> aList) { return get("displayGroupDisplayArrayForObjects", aDisplayGroup, aList); } @@ -155,7 +155,7 @@ public class DebuggingDelegate implements EODisplayGroup.Delegate { * insertion. */ public boolean displayGroupShouldInsertObject(EODisplayGroup aDisplayGroup, Object anObject, int anIndex) { - return ask("displayGroupShouldInsertObject", aDisplayGroup, new Object[] { anObject, new Integer(anIndex) }); + return ask("displayGroupShouldInsertObject", aDisplayGroup, new Object[] { anObject, Integer.valueOf(anIndex) }); } /** @@ -190,9 +190,9 @@ public class DebuggingDelegate implements EODisplayGroup.Delegate { * This method is called by displayGroupDisplayArrayForObjects. This * implementation calls report and returns a copy of the specified list. */ - protected NSArray get(String aTitle, EODisplayGroup aDisplayGroup, List anObjectList) { + protected <T> NSArray<T> get(String aTitle, EODisplayGroup aDisplayGroup, List<T> anObjectList) { report(aTitle, aDisplayGroup, new Object[] { anObjectList }); - return new NSArray(anObjectList); + return new NSArray<>(anObjectList); } /** diff --git a/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/DelegateAdapter.java b/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/DelegateAdapter.java index e801406..c7e549c 100644 --- a/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/DelegateAdapter.java +++ b/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/DelegateAdapter.java @@ -101,8 +101,8 @@ public class DelegateAdapter implements EODisplayGroup.Delegate { * @return An NSArray containing the objects to be displayed for the objects in * the specified list. */ - public NSArray displayGroupDisplayArrayForObjects(EODisplayGroup aDisplayGroup, List aList) { - return new NSArray(aList); + public <T> NSArray<T> displayGroupDisplayArrayForObjects(EODisplayGroup aDisplayGroup, List<T> aList) { + return new NSArray<>(aList); } /** diff --git a/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/EODisplayGroup.java b/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/EODisplayGroup.java index 033f0a9..e2b2b11 100644 --- a/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/EODisplayGroup.java +++ b/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/EODisplayGroup.java @@ -1653,7 +1653,7 @@ public class EODisplayGroup extends Observable implements EOObserving, EOEditing * @return An NSArray containing the objects to be displayed for the objects in * the specified list. */ - NSArray displayGroupDisplayArrayForObjects(EODisplayGroup aDisplayGroup, List aList); + <T> NSArray<T> displayGroupDisplayArrayForObjects(EODisplayGroup aDisplayGroup, List<T> aList); /** * Called by the specified display group before it attempts to change the diff --git a/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/ObservableArray.java b/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/ObservableArray.java index e18ed3b..7755e8f 100644 --- a/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/ObservableArray.java +++ b/projects/net.wotonomy.ui/src/main/java/net/wotonomy/ui/ObservableArray.java @@ -36,7 +36,9 @@ import net.wotonomy.foundation.NSRange; * probably call each other. However, EOObserverCenter will only register us * once per object. */ -class ObservableArray extends NSMutableArray { +class ObservableArray<T> extends NSMutableArray<T> { + private static final long serialVersionUID = 9098414040194393263L; + EOObserving observer; ObservableArray(EOObserving anObserver) { @@ -60,7 +62,7 @@ class ObservableArray extends NSMutableArray { /** * Adds all objects in the specified collection. */ - public void addObjectsFromArray(Collection aCollection) { + public void addObjectsFromArray(Collection<T> aCollection) { addAll(aCollection); } @@ -112,7 +114,7 @@ class ObservableArray extends NSMutableArray { /** * Removes all objects in the specified collection from the array. */ - public void removeObjectsInArray(Collection aCollection) { + public void removeObjectsInArray(Collection<T> aCollection) { removeAll(aCollection); } @@ -134,7 +136,7 @@ class ObservableArray extends NSMutableArray { * objects are removed. If otherRange is larger than currentRange, the extra * objects are added. */ - public void replaceObjectsInRange(NSRange currentRange, List otherArray, NSRange otherRange) { + public void replaceObjectsInRange(NSRange currentRange, List<T> otherArray, NSRange otherRange) { if ((currentRange == null) || (otherArray == null) || (otherRange == null)) return; @@ -183,7 +185,7 @@ class ObservableArray extends NSMutableArray { /** * Removes all occurences of the specified object, comparing by reference. */ - public void removeIdenticalObject(Object anObject) { + public void removeIdenticalObject(T anObject) { EOObserverCenter.removeObserver(observer, anObject); super.removeIdenticalObject(anObject); } @@ -191,32 +193,32 @@ class ObservableArray extends NSMutableArray { /** * Inserts the specified object into this array at the specified index. */ - public void insertObjectAtIndex(Object anObject, int anIndex) { + public void insertObjectAtIndex(T anObject, int anIndex) { add(anIndex, anObject); } /** * Replaces the object at the specified index with the specified object. */ - public void replaceObjectAtIndex(int anIndex, Object anObject) { + public void replaceObjectAtIndex(int anIndex, T anObject) { set(anIndex, anObject); } /** * Adds the specified object to the end of this array. */ - public void addObject(Object anObject) { + public void addObject(T anObject) { add(anObject); } // interface List: mutators - public void add(int index, Object element) { + public void add(int index, T element) { EOObserverCenter.addObserver(observer, element); super.add(index, element); } - public boolean add(Object o) { + public boolean add(T o) { EOObserverCenter.addObserver(observer, o); return super.add(o); } @@ -245,7 +247,7 @@ class ObservableArray extends NSMutableArray { super.clear(); } - public Object remove(int index) { + public T remove(int index) { EOObserverCenter.removeObserver(observer, get(index)); return super.remove(index); } @@ -267,7 +269,7 @@ class ObservableArray extends NSMutableArray { throw new UnsupportedOperationException(); } - public Object set(int index, Object element) { + public T set(int index, T element) { EOObserverCenter.removeObserver(observer, get(index)); EOObserverCenter.addObserver(observer, element); return super.set(index, element); |
