From 5e4034b5cba89460a62fa958fc78c2b85acb3d5f Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 7 Oct 2014 09:18:33 +0200 Subject: Repackage to org.cristalise --- .../java/com/c2kernel/gui/tabs/CollectionPane.java | 122 --------------------- 1 file changed, 122 deletions(-) delete mode 100644 src/main/java/com/c2kernel/gui/tabs/CollectionPane.java (limited to 'src/main/java/com/c2kernel/gui/tabs/CollectionPane.java') diff --git a/src/main/java/com/c2kernel/gui/tabs/CollectionPane.java b/src/main/java/com/c2kernel/gui/tabs/CollectionPane.java deleted file mode 100644 index 9578497..0000000 --- a/src/main/java/com/c2kernel/gui/tabs/CollectionPane.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.c2kernel.gui.tabs; -import java.awt.GridBagConstraints; -import java.util.StringTokenizer; - -import javax.swing.JTabbedPane; - -import com.c2kernel.collection.Aggregation; -import com.c2kernel.collection.Collection; -import com.c2kernel.collection.CollectionDescription; -import com.c2kernel.collection.CollectionMember; -import com.c2kernel.collection.Dependency; -import com.c2kernel.entity.proxy.MemberSubscription; -import com.c2kernel.entity.proxy.ProxyObserver; -import com.c2kernel.gui.tabs.collection.AggregationView; -import com.c2kernel.gui.tabs.collection.CollectionView; -import com.c2kernel.gui.tabs.collection.DependencyView; -import com.c2kernel.persistency.ClusterStorage; -import com.c2kernel.process.Gateway; -import com.c2kernel.utils.Logger; -/** - * @version $Revision: 1.36 $ $Date: 2005/10/06 06:51:15 $ - * @author $Author: abranson $ - */ -public class CollectionPane extends ItemTabPane implements ProxyObserver> -{ - JTabbedPane collTabs; - - public CollectionPane() - { - super("Collection", "Item Collection"); - createLayout(); - } - - @Override - 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()); - if (thisCollView == null){ - if (contents instanceof Aggregation) { - AggregationView thisAggView = new AggregationView(); - thisAggView.setItem(sourceItem.getItem()); - thisAggView.setCollection((Aggregation)contents); - thisCollView = thisAggView; - } - else if (contents instanceof Dependency) { - DependencyView thisDepView = new DependencyView(); - thisDepView.setItem(sourceItem.getItem()); - thisDepView.setCollection((Dependency)contents); - thisCollView = thisDepView; - } - else { - Logger.error("Collection type "+contents.getClass().getName()+" not known"); - return; - } - Logger.msg(3, "Adding new "+thisCollView.getClass().getName()); - collTabs.add(contents.getName()+(contents instanceof CollectionDescription?"*":""), thisCollView); - } - } - - @Override - public void remove(String id) - { - - } - - 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); - } - } - return thisCollView; - } - - protected void createLayout() - { - initPanel(); - // Add the collection tab pane - getGridBagConstraints(); - c.gridx = 0; - c.gridy = 1; - c.fill = GridBagConstraints.BOTH; - c.weighty = 2.0; - collTabs = new JTabbedPane(); - gridbag.setConstraints(collTabs, c); - add(collTabs); - } - - @Override - public void run() - { - Thread.currentThread().setName("Collection Loader"); - sourceItem.getItem().subscribe(new MemberSubscription>(this, ClusterStorage.COLLECTION, false)); - try { - String collNames = sourceItem.getItem().queryData(ClusterStorage.COLLECTION+"/all"); - StringTokenizer tok = new StringTokenizer(collNames, ","); - while (tok.hasMoreTokens()) { - Collection thisLastColl = (Collection) sourceItem.getItem().getObject(ClusterStorage.COLLECTION+"/"+tok.nextToken()+"/last"); - add(thisLastColl); - } - } catch (Exception e) { - Logger.error(e); - Logger.msg(2, "Error loading collections"); - } - } - - @Override - public void reload() - { - Gateway.getStorage().clearCache(sourceItem.getItemPath(), ClusterStorage.COLLECTION); - collTabs.removeAll(); - initForItem(sourceItem); - } - - @Override - public void control(String control, String msg) { - } -} -- cgit v1.2.3