summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/gui/tabs/collection
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2012-05-30 08:37:45 +0200
committerAndrew Branson <andrew.branson@cern.ch>2012-05-30 08:37:45 +0200
commitb086f57f56bf0eb9dab9cf321a0f69aaaae84347 (patch)
tree8e6e26e8b7eed6abad7a17b093bdbb55c5e6b1ba /source/com/c2kernel/gui/tabs/collection
parent22088ae8d2d5ff390518dbe1c4372325ffb3a647 (diff)
Initial Maven Conversion
Diffstat (limited to 'source/com/c2kernel/gui/tabs/collection')
-rw-r--r--source/com/c2kernel/gui/tabs/collection/AggregationView.java90
-rw-r--r--source/com/c2kernel/gui/tabs/collection/CollectionHistoryWindow.java192
-rw-r--r--source/com/c2kernel/gui/tabs/collection/CollectionView.java49
-rw-r--r--source/com/c2kernel/gui/tabs/collection/DependencyView.java34
4 files changed, 0 insertions, 365 deletions
diff --git a/source/com/c2kernel/gui/tabs/collection/AggregationView.java b/source/com/c2kernel/gui/tabs/collection/AggregationView.java
deleted file mode 100644
index b6578bb..0000000
--- a/source/com/c2kernel/gui/tabs/collection/AggregationView.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package com.c2kernel.gui.tabs.collection;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-import javax.swing.JSplitPane;
-
-import com.c2kernel.collection.Aggregation;
-import com.c2kernel.collection.AggregationMember;
-import com.c2kernel.collection.Collection;
-import com.c2kernel.collection.gui.model.AggregationVertexFactory;
-import com.c2kernel.collection.gui.model.AggregationVertexOutlineCreator;
-import com.c2kernel.collection.gui.view.AggregationMemberRenderer;
-import com.c2kernel.collection.gui.view.PropertyPanel;
-import com.c2kernel.collection.gui.view.SelectedMemberPanel;
-import com.c2kernel.graph.view.EditorPanel;
-import com.c2kernel.graph.view.GraphPanel;
-import com.c2kernel.gui.MainFrame;
-import com.c2kernel.utils.Language;
-import com.c2kernel.utils.Resource;
-/**
- * @version $Revision: 1.5 $ $Date: 2006/09/15 15:02:24 $
- * @author $Author: abranson $
- */
-public class AggregationView extends CollectionView<AggregationMember>
-{
- protected JButton mSaveButton = new JButton(Resource.findImage("graph/save.png"));
- protected JButton mHistoryButton = new JButton(Resource.findImage("graph/history.png"));
- protected JButton[] mOtherToolBarButtons = { mSaveButton, mHistoryButton };
- // Graph editor panel
- protected EditorPanel mEditorPanel;
- // Objects to view/modify the properties of the selected activity
- protected PropertyPanel mPropertyPanel;
- protected JSplitPane mSplitPane;
- private final AggregationVertexFactory mAggregationVertexFactory = new AggregationVertexFactory();
- private final AggregationMemberRenderer mAggregationMemberRenderer = new AggregationMemberRenderer();
- public AggregationView()
- {
- super();
- setLayout(new GridLayout(1,1));
- mPropertyPanel = new PropertyPanel();
- mEditorPanel = new EditorPanel(null, mAggregationVertexFactory, new AggregationVertexOutlineCreator(), false, mOtherToolBarButtons, new GraphPanel(null, mAggregationMemberRenderer));
- createLayout();
- createListeners();
- mPropertyPanel.setGraphModelManager(mEditorPanel.mGraphModelManager);
- mPropertyPanel.createLayout(new SelectedMemberPanel());
- mEditorPanel.setEditable(MainFrame.isAdmin);
- }
-
- @Override
- public void setCollection(Collection<AggregationMember> contents)
- {
- thisColl = contents;
- Aggregation agg = (Aggregation)thisColl;
- mPropertyPanel.setCollection(agg);
- mAggregationMemberRenderer.setAggregation(agg);
- mEditorPanel.mGraphModelManager.setModel(agg.getLayout());
- mEditorPanel.updateVertexTypes(agg.getVertexTypeNameAndConstructionInfo());
- mEditorPanel.enterSelectMode();
- mAggregationVertexFactory.setCreationContext(agg);
- }
- public void createLayout()
- {
- mSaveButton.setToolTipText(Language.translate("Save Layout Changes"));
- mSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mEditorPanel, mPropertyPanel);
- mSplitPane.setDividerSize(5);
- add(mSplitPane);
- }
-
- protected void createListeners()
- {
- mSaveButton.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent ae)
- {
- saveCollection();
- }
- });
- mHistoryButton.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent ae)
- {
- new CollectionHistoryWindow(item, (Aggregation)thisColl);
- }
- });
- }
-}
diff --git a/source/com/c2kernel/gui/tabs/collection/CollectionHistoryWindow.java b/source/com/c2kernel/gui/tabs/collection/CollectionHistoryWindow.java
deleted file mode 100644
index ee168b0..0000000
--- a/source/com/c2kernel/gui/tabs/collection/CollectionHistoryWindow.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package com.c2kernel.gui.tabs.collection;
-
-import java.awt.HeadlessException;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.util.ArrayList;
-
-import javax.swing.JFrame;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.table.AbstractTableModel;
-
-import com.c2kernel.collection.Aggregation;
-import com.c2kernel.collection.Collection;
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.proxy.EntityProxy;
-import com.c2kernel.entity.proxy.EntityProxyObserver;
-import com.c2kernel.entity.proxy.ItemProxy;
-import com.c2kernel.entity.proxy.MemberSubscription;
-import com.c2kernel.events.Event;
-import com.c2kernel.gui.MainFrame;
-import com.c2kernel.lifecycle.instance.predefined.PredefinedStep;
-import com.c2kernel.lookup.EntityPath;
-import com.c2kernel.lookup.InvalidEntityPathException;
-import com.c2kernel.persistency.ClusterStorage;
-import com.c2kernel.persistency.outcome.Outcome;
-import com.c2kernel.process.Gateway;
-import com.c2kernel.utils.CastorXMLUtility;
-import com.c2kernel.utils.Language;
-import com.c2kernel.utils.Logger;
-
-public class CollectionHistoryWindow extends JFrame {
-
- JTable historyTable;
- HistoryTableModel historyModel;
-
- public CollectionHistoryWindow(ItemProxy item, Aggregation coll) throws HeadlessException {
- super("Collection History");
- historyModel = new HistoryTableModel(item, coll);
- historyTable = new JTable(historyModel);
- this.getContentPane().add(new JScrollPane(historyTable));
- historyTable.addMouseListener(new HistoryTableListener(item));
- this.pack();
- super.toFront();
- this.validate();
- this.show();
- }
-
- private class HistoryTableModel extends AbstractTableModel implements EntityProxyObserver<Event> {
-
- ItemProxy item;
- ArrayList<Event> collEvents;
- ArrayList<Object> collEventData;
- Aggregation coll;
- public HistoryTableModel(ItemProxy item, Aggregation coll) {
- this.item = item;
- this.coll = coll;
- collEvents = new ArrayList<Event>();
- collEventData = new ArrayList<Object>();
- item.subscribe(new MemberSubscription<Event>(this, ClusterStorage.HISTORY, true));
- }
- @Override
- public int getColumnCount() {
- return 4;
- }
-
- @Override
- public String getColumnName(int columnIndex) {
- switch(columnIndex) {
- case 0: return Language.translate("Date");
- case 1: return Language.translate("Operation");
- case 2: return Language.translate("Slot");
- case 3: return Language.translate("Child");
- default: return "";
- }
- }
- @Override
- public int getRowCount() {
- return collEvents.size();
- }
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- Event ev = collEvents.get(rowIndex);
- switch (columnIndex) {
- case 0:
- return ev.getTimeString();
- case 1:
- if (ev.getStepName().equals("AssignItemToSlot"))
- return "Item Assigned";
- else
- return "Collection replaced";
- case 2:
- if (ev.getStepName().equals("AssignItemToSlot"))
- return ((String[])collEventData.get(rowIndex))[1];
- return "";
- case 3:
- if (ev.getStepName().equals("AddC2KObject"))
- return "Click to view";
- String name;
- try {
- EntityProxy childItem = Gateway.getProxyManager().getProxy(new EntityPath(Integer.parseInt(((String[])collEventData.get(rowIndex))[2])));
- name = childItem.getName();
- } catch (NumberFormatException e) {
- name = "Invalid entity key: "+((String[])collEventData.get(rowIndex))[2];
- } catch (ObjectNotFoundException e) {
- name = "Item deleted: "+((String[])collEventData.get(rowIndex))[2];
- } catch (InvalidEntityPathException e) {
- name = "Invalid entity key: "+((String[])collEventData.get(rowIndex))[2];
- }
- return name;
- default:
- return "";
- }
- }
- public Object getEventData(int row) {
- return collEventData.get(row);
- }
- @Override
- public void add(Event thisEv) {
- if (thisEv.getStepName().equals("AssignItemToSlot") || thisEv.getStepName().equals("AddC2KObject")) {
- String[] params;
- try {
- Outcome oc = (Outcome)item.getObject(ClusterStorage.OUTCOME+"/PredefinedStepOutcome/0/"+thisEv.getID());
- params = PredefinedStep.getDataList(oc.getData());
- } catch (ObjectNotFoundException ex) { return; }
- if (thisEv.getStepName().equals("AssignItemToSlot")) {
- if (params[0].equals(coll.getName()))
- collEventData.add(params);
- else return;
- }
- else {
- Object obj;
- try {
- obj = CastorXMLUtility.unmarshall(params[0]);
- } catch (Exception e) {
- Logger.error(e);
- return;
- }
- if (obj instanceof Collection)
- collEventData.add(obj);
- else return;
-
- }
- }
- else return;
- collEvents.add(thisEv);
- fireTableRowsInserted(collEvents.size()-1, collEvents.size()-1);
- }
- @Override
- public void remove(String id) { }
- @Override
- public void control(String control, String msg) {
- }
- }
-
- private class HistoryTableListener extends MouseAdapter {
-
- ItemProxy item;
- public HistoryTableListener(ItemProxy item) {
- this.item = item;
- }
-
- @Override
- public void mouseClicked(MouseEvent e) {
- if (e.getClickCount()==2) {
- int row = historyTable.getSelectedRow();
- Object data = historyModel.getEventData(row);
- if (data instanceof Aggregation) {
- showColl((Aggregation)data);
- }
- else {
- String[] params = (String[])data;
- try {
- EntityProxy childItem = Gateway.getProxyManager().getProxy(new EntityPath(Integer.parseInt(params[2])));
- MainFrame.itemFinder.pushNewKey(childItem.getName());
- } catch (Exception ex) { }
- }
- }
- }
- public void showColl(Aggregation coll) {
- JFrame newFrame = new JFrame();
- AggregationView newView = new AggregationView();
- newView.setCollection(coll);
- newView.setItem(item);
- newFrame.getContentPane().add(newView);
- newFrame.pack();
- newFrame.toFront();
- newFrame.validate();
- newFrame.show();
- }
- }
-}
diff --git a/source/com/c2kernel/gui/tabs/collection/CollectionView.java b/source/com/c2kernel/gui/tabs/collection/CollectionView.java
deleted file mode 100644
index c698430..0000000
--- a/source/com/c2kernel/gui/tabs/collection/CollectionView.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.c2kernel.gui.tabs.collection;
-
-import javax.swing.JPanel;
-
-import com.c2kernel.collection.Collection;
-import com.c2kernel.collection.CollectionMember;
-import com.c2kernel.entity.proxy.ItemProxy;
-import com.c2kernel.gui.MainFrame;
-import com.c2kernel.utils.Logger;
-
-/**************************************************************************
- *
- * $Revision: 1.1 $
- * $Date: 2004/08/10 07:56:08 $
- *
- * Copyright (C) 2003 CERN - European Organization for Nuclear Research
- * All rights reserved.
- **************************************************************************/
-
-
-public abstract class CollectionView<M extends CollectionMember> extends JPanel {
-
- protected Collection<M> thisColl;
- protected ItemProxy item;
-
- public CollectionView() {
- super();
- }
-
- public void setItem(ItemProxy entity) {
- this.item = entity;
- }
-
- public abstract void setCollection(Collection<M> coll);
-
- protected void saveCollection()
- {
- try
- {
- String[] params = new String[1];
- params[0] = com.c2kernel.utils.CastorXMLUtility.marshall(thisColl);
- MainFrame.userAgent.execute(item, "AddC2KObject", params);
- }
- catch (Exception e)
- {
- Logger.error(e);
- }
- }
-}
diff --git a/source/com/c2kernel/gui/tabs/collection/DependencyView.java b/source/com/c2kernel/gui/tabs/collection/DependencyView.java
deleted file mode 100644
index e068bdc..0000000
--- a/source/com/c2kernel/gui/tabs/collection/DependencyView.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.c2kernel.gui.tabs.collection;
-import java.awt.GridLayout;
-
-import javax.swing.JLabel;
-
-import com.c2kernel.collection.Collection;
-import com.c2kernel.collection.DependencyMember;
-/**
- * @version $Revision: 1.2 $ $Date: 2005/06/02 12:17:22 $
- * @author $Author: abranson $
- */
-public class DependencyView extends CollectionView<DependencyMember>
-{
- // Objects to view/modify the properties of the selected activity
-
- public DependencyView()
- {
- super();
- setLayout(new GridLayout(1,1));
- createLayout();
- }
-
- @Override
- public void setCollection(Collection<DependencyMember> contents)
- {
- thisColl = contents;
- }
- public void createLayout()
- {
- // TODO: design a nice dependency view, with property viewing and modification
- add(new JLabel("Dependency view not yet implemented. Please browse the tree instead."));
- }
-
-}