diff options
Diffstat (limited to 'source/com/c2kernel/gui/tabs/collection')
| -rw-r--r--[-rwxr-xr-x] | source/com/c2kernel/gui/tabs/collection/AggregationView.java | 7 | ||||
| -rw-r--r-- | source/com/c2kernel/gui/tabs/collection/CollectionHistoryWindow.java | 44 | ||||
| -rw-r--r--[-rwxr-xr-x] | source/com/c2kernel/gui/tabs/collection/CollectionView.java | 10 | ||||
| -rw-r--r--[-rwxr-xr-x] | source/com/c2kernel/gui/tabs/collection/DependencyView.java | 3 |
4 files changed, 39 insertions, 25 deletions
diff --git a/source/com/c2kernel/gui/tabs/collection/AggregationView.java b/source/com/c2kernel/gui/tabs/collection/AggregationView.java index 8a97c6c..3291906 100755..100644 --- a/source/com/c2kernel/gui/tabs/collection/AggregationView.java +++ b/source/com/c2kernel/gui/tabs/collection/AggregationView.java @@ -47,7 +47,8 @@ public class AggregationView extends CollectionView mEditorPanel.setEditable(MainFrame.isAdmin);
}
- public void setCollection(Collection contents)
+ @Override
+ public void setCollection(Collection<?> contents)
{
thisColl = contents;
Aggregation agg = (Aggregation)thisColl;
@@ -70,6 +71,7 @@ public class AggregationView extends CollectionView {
mSaveButton.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent ae)
{
saveCollection();
@@ -77,10 +79,11 @@ public class AggregationView extends CollectionView });
mHistoryButton.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent ae)
{
new CollectionHistoryWindow(item, thisColl);
}
- });
+ });
}
}
diff --git a/source/com/c2kernel/gui/tabs/collection/CollectionHistoryWindow.java b/source/com/c2kernel/gui/tabs/collection/CollectionHistoryWindow.java index bb71cd8..7cb2753 100644 --- a/source/com/c2kernel/gui/tabs/collection/CollectionHistoryWindow.java +++ b/source/com/c2kernel/gui/tabs/collection/CollectionHistoryWindow.java @@ -12,10 +12,10 @@ import javax.swing.table.AbstractTableModel; import com.c2kernel.collection.Collection;
import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.C2KLocalObject;
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;
@@ -32,8 +32,8 @@ public class CollectionHistoryWindow extends JFrame { JTable historyTable;
HistoryTableModel historyModel;
-
- public CollectionHistoryWindow(ItemProxy item, Collection coll) throws HeadlessException {
+
+ public CollectionHistoryWindow(ItemProxy item, Collection<?> coll) throws HeadlessException {
super("Collection History");
historyModel = new HistoryTableModel(item, coll);
historyTable = new JTable(historyModel);
@@ -44,23 +44,25 @@ public class CollectionHistoryWindow extends JFrame { this.validate();
this.show();
}
-
- private class HistoryTableModel extends AbstractTableModel implements EntityProxyObserver {
+
+ private class HistoryTableModel extends AbstractTableModel implements EntityProxyObserver<Event> {
ItemProxy item;
ArrayList<Object> collEvents, collEventData;
- Collection coll;
- public HistoryTableModel(ItemProxy item, Collection coll) {
+ Collection<?> coll;
+ public HistoryTableModel(ItemProxy item, Collection<?> coll) {
this.item = item;
this.coll = coll;
collEvents = new ArrayList<Object>();
collEventData = new ArrayList<Object>();
- item.subscribe(this, ClusterStorage.HISTORY, true);
+ 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");
@@ -69,10 +71,12 @@ public class CollectionHistoryWindow extends JFrame { 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 = (Event)collEvents.get(rowIndex);
switch (columnIndex) {
@@ -109,9 +113,8 @@ public class CollectionHistoryWindow extends JFrame { public Object getEventData(int row) {
return collEventData.get(row);
}
- public void add(C2KLocalObject contents) {
- if (!(contents instanceof Event)) return;
- Event thisEv = (Event)contents;
+ @Override
+ public void add(Event thisEv) {
if (thisEv.getStepName().equals("AssignItemToSlot") || thisEv.getStepName().equals("AddC2KObject")) {
String[] params;
try {
@@ -134,16 +137,22 @@ public class CollectionHistoryWindow extends JFrame { 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) {
+ // TODO Auto-generated method stub
+
+ }
}
-
+
private class HistoryTableListener extends MouseAdapter {
ItemProxy item;
@@ -151,12 +160,13 @@ public class CollectionHistoryWindow extends JFrame { 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 Collection) {
- showColl((Collection)data);
+ showColl((Collection<?>)data);
}
else {
String[] params = (String[])data;
@@ -167,7 +177,7 @@ public class CollectionHistoryWindow extends JFrame { }
}
}
- public void showColl(Collection coll) {
+ public void showColl(Collection<?> coll) {
JFrame newFrame = new JFrame();
AggregationView newView = new AggregationView();
newView.setCollection(coll);
diff --git a/source/com/c2kernel/gui/tabs/collection/CollectionView.java b/source/com/c2kernel/gui/tabs/collection/CollectionView.java index 62a598c..8a97af5 100755..100644 --- a/source/com/c2kernel/gui/tabs/collection/CollectionView.java +++ b/source/com/c2kernel/gui/tabs/collection/CollectionView.java @@ -19,19 +19,19 @@ import com.c2kernel.utils.Logger; public abstract class CollectionView extends JPanel {
- protected Collection thisColl;
+ protected Collection<?> thisColl;
protected ItemProxy item;
public CollectionView() {
super();
}
-
+
public void setItem(ItemProxy entity) {
this.item = entity;
}
-
- public abstract void setCollection(Collection coll);
-
+
+ public abstract void setCollection(Collection<?> coll);
+
protected void saveCollection()
{
try
diff --git a/source/com/c2kernel/gui/tabs/collection/DependencyView.java b/source/com/c2kernel/gui/tabs/collection/DependencyView.java index 4465d6a..14e2af0 100755..100644 --- a/source/com/c2kernel/gui/tabs/collection/DependencyView.java +++ b/source/com/c2kernel/gui/tabs/collection/DependencyView.java @@ -19,7 +19,8 @@ public class DependencyView extends CollectionView createLayout();
}
- public void setCollection(Collection contents)
+ @Override
+ public void setCollection(Collection<?> contents)
{
thisColl = contents;
}
|
