summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/gui/tabs/CollectionPane.java
diff options
context:
space:
mode:
Diffstat (limited to 'source/com/c2kernel/gui/tabs/CollectionPane.java')
-rw-r--r--source/com/c2kernel/gui/tabs/CollectionPane.java28
1 files changed, 17 insertions, 11 deletions
diff --git a/source/com/c2kernel/gui/tabs/CollectionPane.java b/source/com/c2kernel/gui/tabs/CollectionPane.java
index 7511a97..a8abfcd 100644
--- a/source/com/c2kernel/gui/tabs/CollectionPane.java
+++ b/source/com/c2kernel/gui/tabs/CollectionPane.java
@@ -5,6 +5,7 @@ import javax.swing.JTabbedPane;
import com.c2kernel.collection.Aggregation;
import com.c2kernel.collection.Collection;
+import com.c2kernel.collection.CollectionMember;
import com.c2kernel.collection.Dependency;
import com.c2kernel.entity.proxy.EntityProxyObserver;
import com.c2kernel.entity.proxy.ItemProxy;
@@ -19,7 +20,7 @@ import com.c2kernel.utils.Logger;
* @version $Revision: 1.36 $ $Date: 2005/10/06 06:51:15 $
* @author $Author: abranson $
*/
-public class CollectionPane extends EntityTabPane implements EntityProxyObserver<Collection<?>>
+public class CollectionPane extends EntityTabPane implements EntityProxyObserver<Collection<? extends CollectionMember>>
{
JTabbedPane collTabs;
@@ -30,16 +31,22 @@ public class CollectionPane extends EntityTabPane implements EntityProxyObserver
}
@Override
- public void add(Collection<?> contents)
+ public void add(Collection<? extends CollectionMember> contents)
{
Logger.msg(5, "Got "+contents.getName()+": "+contents.getClass().getName());
Logger.msg(7, "Looking for existing "+contents.getName());
- CollectionView thisCollView = findTabForCollName(contents.getName());
+ CollectionView<? extends CollectionMember> thisCollView = findTabForCollName(contents.getName());
if (thisCollView == null){
- if (contents instanceof Aggregation)
- thisCollView = new AggregationView();
- else if (contents instanceof Dependency)
- thisCollView = new DependencyView();
+ if (contents instanceof Aggregation) {
+ AggregationView thisAggView = new AggregationView();
+ thisAggView.setCollection((Aggregation)contents);
+ thisCollView = thisAggView;
+ }
+ else if (contents instanceof Dependency) {
+ DependencyView thisDepView = new DependencyView();
+ thisDepView.setCollection((Dependency)contents);
+ thisCollView = thisDepView;
+ }
else {
Logger.error("Collection type "+contents.getClass().getName()+" not known");
return;
@@ -48,7 +55,6 @@ public class CollectionPane extends EntityTabPane implements EntityProxyObserver
thisCollView.setItem((ItemProxy)sourceEntity.getEntity());
collTabs.add(contents.getName(), thisCollView);
}
- thisCollView.setCollection(contents);
}
@Override
@@ -57,12 +63,12 @@ public class CollectionPane extends EntityTabPane implements EntityProxyObserver
}
- private CollectionView findTabForCollName(String collName) {
- CollectionView thisCollView = null;
+ private CollectionView<? extends CollectionMember> findTabForCollName(String collName) {
+ CollectionView<? extends CollectionMember> thisCollView = null;
for (int i = 0; i < collTabs.getTabCount(); i++) {
String tabName = collTabs.getTitleAt(i);
if (tabName.equals(collName)) {
- thisCollView = (CollectionView)collTabs.getComponentAt(i);
+ thisCollView = (CollectionView<? extends CollectionMember>)collTabs.getComponentAt(i);
}
}
return thisCollView;