From 379ed8a0e133bee650e0acb24f6b743f657a50d0 Mon Sep 17 00:00:00 2001 From: abranson Date: Thu, 4 Aug 2011 16:08:49 +0200 Subject: Last bit of cleanup honest New castor and dependent commons libs --- source/com/c2kernel/gui/tabs/CollectionPane.java | 28 ++++++++++++++---------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'source/com/c2kernel/gui/tabs/CollectionPane.java') 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> +public class CollectionPane extends EntityTabPane implements EntityProxyObserver> { JTabbedPane collTabs; @@ -30,16 +31,22 @@ public class CollectionPane extends EntityTabPane implements EntityProxyObserver } @Override - public void add(Collection contents) + public void add(Collection contents) { Logger.msg(5, "Got "+contents.getName()+": "+contents.getClass().getName()); Logger.msg(7, "Looking for existing "+contents.getName()); - CollectionView thisCollView = findTabForCollName(contents.getName()); + CollectionView 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 findTabForCollName(String collName) { + CollectionView 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)collTabs.getComponentAt(i); } } return thisCollView; -- cgit v1.2.3