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/data/NodeCollection.java | 8 +++---- source/com/c2kernel/gui/data/NodeContext.java | 4 ++-- source/com/c2kernel/gui/tabs/CollectionPane.java | 28 +++++++++++++--------- source/com/c2kernel/gui/tabs/ViewpointPane.java | 11 ++++----- .../gui/tabs/collection/AggregationView.java | 11 +++++---- .../tabs/collection/CollectionHistoryWindow.java | 20 +++++++++------- .../gui/tabs/collection/CollectionView.java | 7 +++--- .../gui/tabs/collection/DependencyView.java | 5 ++-- .../gui/tabs/execution/ActivityViewer.java | 2 +- .../c2kernel/gui/tabs/outcome/form/DataRecord.java | 2 -- .../gui/tabs/outcome/form/OutcomePanel.java | 5 ++-- .../gui/tabs/outcome/form/field/ComboField.java | 4 ++-- .../tabs/outcome/form/field/StringEditField.java | 10 ++++---- 13 files changed, 61 insertions(+), 56 deletions(-) (limited to 'source/com/c2kernel/gui') diff --git a/source/com/c2kernel/gui/data/NodeCollection.java b/source/com/c2kernel/gui/data/NodeCollection.java index f55f8cd..ceee16f 100644 --- a/source/com/c2kernel/gui/data/NodeCollection.java +++ b/source/com/c2kernel/gui/data/NodeCollection.java @@ -16,7 +16,7 @@ import com.c2kernel.utils.Logger; public class NodeCollection extends Node { ItemProxy parent; - Parent2ChildCollection thisCollection; + Parent2ChildCollection thisCollection; String path; public NodeCollection(ItemProxy parent, String name, EntityTabManager desktop) { @@ -32,7 +32,7 @@ public class NodeCollection extends Node { public void loadChildren() { Logger.msg(8, "NodeCollection::loadChildren()"); try { - thisCollection = (Parent2ChildCollection)parent.getObject("Collection/"+name); + thisCollection = (Parent2ChildCollection)parent.getObject("Collection/"+name); } catch (ObjectNotFoundException ex) { end(false); return; @@ -41,10 +41,10 @@ public class NodeCollection extends Node { this.type = thisCollection.getClass().getName(); int lastDot = this.type.lastIndexOf('.'); if (lastDot > -1) this.type = this.type.substring(lastDot+1); - ArrayList collectionMembers = thisCollection.getMembers().list; + ArrayList collectionMembers = thisCollection.getMembers().list; for (int i=0; i children; + Enumeration children; public NodeContext(Path path, EntityTabManager desktop) { super(path, desktop); @@ -31,7 +31,7 @@ public class NodeContext extends Node implements DomainPathSubscriber { int batch = 75; while (children.hasMoreElements() && batch > 0) { - Path newPath = (Path)children.nextElement(); + Path newPath = children.nextElement(); if (newPath == null) break; Logger.msg(2, "Subscription.run() - new node: " + newPath ); add( newNode(newPath)); 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; diff --git a/source/com/c2kernel/gui/tabs/ViewpointPane.java b/source/com/c2kernel/gui/tabs/ViewpointPane.java index a0f63ab..a793e5d 100644 --- a/source/com/c2kernel/gui/tabs/ViewpointPane.java +++ b/source/com/c2kernel/gui/tabs/ViewpointPane.java @@ -441,7 +441,7 @@ public class ViewpointPane extends EntityTabPane implements ItemListener, Action // we don't really remove viewpoints } - class EventItem implements Comparable { + class EventItem implements Comparable { public int eventId; public int schemaVersion; public ArrayList viewNames = new ArrayList(); @@ -500,12 +500,9 @@ public class ViewpointPane extends EntityTabPane implements ItemListener, Action } @Override - public int compareTo(Object o) { - if (o instanceof EventItem) { - EventItem other = (EventItem)o; - if (other.eventId < eventId) return 1; - if (other.eventId > eventId) return -1; - } + public int compareTo(EventItem other) { + if (other.eventId < eventId) return 1; + if (other.eventId > eventId) return -1; return 0; } } diff --git a/source/com/c2kernel/gui/tabs/collection/AggregationView.java b/source/com/c2kernel/gui/tabs/collection/AggregationView.java index 3291906..35cdb11 100644 --- a/source/com/c2kernel/gui/tabs/collection/AggregationView.java +++ b/source/com/c2kernel/gui/tabs/collection/AggregationView.java @@ -7,6 +7,7 @@ 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; @@ -22,7 +23,7 @@ import com.c2kernel.utils.Resource; * @version $Revision: 1.5 $ $Date: 2006/09/15 15:02:24 $ * @author $Author: abranson $ */ -public class AggregationView extends CollectionView +public class AggregationView extends CollectionView { protected JButton mSaveButton = new JButton(Resource.getImageResource("graph/save.png")); protected JButton mHistoryButton = new JButton(Resource.getImageResource("graph/history.png")); @@ -32,8 +33,8 @@ public class AggregationView extends CollectionView // Objects to view/modify the properties of the selected activity protected PropertyPanel mPropertyPanel; protected JSplitPane mSplitPane; - private AggregationVertexFactory mAggregationVertexFactory = new AggregationVertexFactory(); - private AggregationMemberRenderer mAggregationMemberRenderer = new AggregationMemberRenderer(); + private final AggregationVertexFactory mAggregationVertexFactory = new AggregationVertexFactory(); + private final AggregationMemberRenderer mAggregationMemberRenderer = new AggregationMemberRenderer(); public AggregationView() { super(); @@ -48,7 +49,7 @@ public class AggregationView extends CollectionView } @Override - public void setCollection(Collection contents) + public void setCollection(Collection contents) { thisColl = contents; Aggregation agg = (Aggregation)thisColl; @@ -82,7 +83,7 @@ public class AggregationView extends CollectionView @Override public void actionPerformed(ActionEvent ae) { - new CollectionHistoryWindow(item, thisColl); + 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 index 7cb2753..0f3cc76 100644 --- a/source/com/c2kernel/gui/tabs/collection/CollectionHistoryWindow.java +++ b/source/com/c2kernel/gui/tabs/collection/CollectionHistoryWindow.java @@ -10,6 +10,7 @@ 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; @@ -33,7 +34,7 @@ public class CollectionHistoryWindow extends JFrame { JTable historyTable; HistoryTableModel historyModel; - public CollectionHistoryWindow(ItemProxy item, Collection coll) throws HeadlessException { + public CollectionHistoryWindow(ItemProxy item, Aggregation coll) throws HeadlessException { super("Collection History"); historyModel = new HistoryTableModel(item, coll); historyTable = new JTable(historyModel); @@ -48,12 +49,13 @@ public class CollectionHistoryWindow extends JFrame { private class HistoryTableModel extends AbstractTableModel implements EntityProxyObserver { ItemProxy item; - ArrayList collEvents, collEventData; - Collection coll; - public HistoryTableModel(ItemProxy item, Collection coll) { + ArrayList collEvents; + ArrayList collEventData; + Aggregation coll; + public HistoryTableModel(ItemProxy item, Aggregation coll) { this.item = item; this.coll = coll; - collEvents = new ArrayList(); + collEvents = new ArrayList(); collEventData = new ArrayList(); item.subscribe(new MemberSubscription(this, ClusterStorage.HISTORY, true)); } @@ -78,7 +80,7 @@ public class CollectionHistoryWindow extends JFrame { } @Override public Object getValueAt(int rowIndex, int columnIndex) { - Event ev = (Event)collEvents.get(rowIndex); + Event ev = collEvents.get(rowIndex); switch (columnIndex) { case 0: return ev.getTimeString(); @@ -165,8 +167,8 @@ public class CollectionHistoryWindow extends JFrame { if (e.getClickCount()==2) { int row = historyTable.getSelectedRow(); Object data = historyModel.getEventData(row); - if (data instanceof Collection) { - showColl((Collection)data); + if (data instanceof Aggregation) { + showColl((Aggregation)data); } else { String[] params = (String[])data; @@ -177,7 +179,7 @@ public class CollectionHistoryWindow extends JFrame { } } } - public void showColl(Collection coll) { + public void showColl(Aggregation 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 8a97af5..c698430 100644 --- a/source/com/c2kernel/gui/tabs/collection/CollectionView.java +++ b/source/com/c2kernel/gui/tabs/collection/CollectionView.java @@ -3,6 +3,7 @@ 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; @@ -17,9 +18,9 @@ import com.c2kernel.utils.Logger; **************************************************************************/ -public abstract class CollectionView extends JPanel { +public abstract class CollectionView extends JPanel { - protected Collection thisColl; + protected Collection thisColl; protected ItemProxy item; public CollectionView() { @@ -30,7 +31,7 @@ public abstract class CollectionView extends JPanel { this.item = entity; } - public abstract void setCollection(Collection coll); + public abstract void setCollection(Collection coll); protected void saveCollection() { diff --git a/source/com/c2kernel/gui/tabs/collection/DependencyView.java b/source/com/c2kernel/gui/tabs/collection/DependencyView.java index 14e2af0..734d315 100644 --- a/source/com/c2kernel/gui/tabs/collection/DependencyView.java +++ b/source/com/c2kernel/gui/tabs/collection/DependencyView.java @@ -4,11 +4,12 @@ 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 +public class DependencyView extends CollectionView { // Objects to view/modify the properties of the selected activity @@ -20,7 +21,7 @@ public class DependencyView extends CollectionView } @Override - public void setCollection(Collection contents) + public void setCollection(Collection contents) { thisColl = contents; } diff --git a/source/com/c2kernel/gui/tabs/execution/ActivityViewer.java b/source/com/c2kernel/gui/tabs/execution/ActivityViewer.java index b6ef7f8..73e9612 100644 --- a/source/com/c2kernel/gui/tabs/execution/ActivityViewer.java +++ b/source/com/c2kernel/gui/tabs/execution/ActivityViewer.java @@ -43,7 +43,7 @@ public class ActivityViewer extends JPanel implements Runnable { JLabel noOutcome = new JLabel(Language.translate("No outcome data is required for this activity")); ExecutionPane parent; JLabel status; - JComboBox executors; + JComboBox executors; JButton saveButton = new JButton("Save"); JButton loadButton = new JButton("Load"); GridBagLayout gridbag = new GridBagLayout(); diff --git a/source/com/c2kernel/gui/tabs/outcome/form/DataRecord.java b/source/com/c2kernel/gui/tabs/outcome/form/DataRecord.java index 7477ecd..3bfe3fd 100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/DataRecord.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/DataRecord.java @@ -3,7 +3,6 @@ import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; -import java.util.ArrayList; import javax.swing.JLabel; import javax.swing.JTabbedPane; @@ -25,7 +24,6 @@ public class DataRecord extends OutcomeStructure implements ChangeListener { AttributeList myAttributes; JTabbedPane DRPanel = null; boolean deferred; - ArrayList deferredChildren = new ArrayList(); Document parentDoc; GridBagConstraints position; GridBagLayout gridbag; diff --git a/source/com/c2kernel/gui/tabs/outcome/form/OutcomePanel.java b/source/com/c2kernel/gui/tabs/outcome/form/OutcomePanel.java index 6d20183..63c1d3d 100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/OutcomePanel.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/OutcomePanel.java @@ -6,7 +6,6 @@ import java.io.IOException; import java.io.StringReader; import java.io.StringWriter; import java.net.URL; -import java.util.Enumeration; import javax.swing.Box; import javax.swing.JComponent; @@ -275,9 +274,9 @@ public class OutcomePanel extends JPanel implements OutcomeHandler ElementDecl rootElementDecl = null; docElement = (outcomeDOM == null) ? null : outcomeDOM.getDocumentElement(); - for (Enumeration globalElements = schemaSOM.getElementDecls(); globalElements.hasMoreElements();) + for (ElementDecl elementDecl: schemaSOM.getElementDecls()) { - rootElementDecl = (ElementDecl) globalElements.nextElement(); + rootElementDecl = elementDecl; // REVISIT: We don't detect which is the most likely root element if there is more than one root decl // xmlspy looks for an element not referenced elsewhere. simple but hard // if we already have a document then use its root element to find the right decl diff --git a/source/com/c2kernel/gui/tabs/outcome/form/field/ComboField.java b/source/com/c2kernel/gui/tabs/outcome/form/field/ComboField.java index ef56046..58b2c37 100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/field/ComboField.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/field/ComboField.java @@ -86,9 +86,9 @@ public class ComboField extends StringEditField { // TODO: should be ANDed with above results if (content.hasFacet(Facet.ENUMERATION)) { //ListOfValues andList = new ListOfValues(); - Enumeration enums = content.getFacets(Facet.ENUMERATION); + Enumeration enums = content.getFacets(Facet.ENUMERATION); while (enums.hasMoreElements()) { - Facet thisEnum = (Facet)enums.nextElement(); + Facet thisEnum = enums.nextElement(); vals.put(thisEnum.getValue(), thisEnum.getValue(), false); } } diff --git a/source/com/c2kernel/gui/tabs/outcome/form/field/StringEditField.java b/source/com/c2kernel/gui/tabs/outcome/form/field/StringEditField.java index a9b55a4..5f6a384 100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/field/StringEditField.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/field/StringEditField.java @@ -62,12 +62,12 @@ public class StringEditField implements FocusListener, DomainKeyConsumer { // is a combobox if (type.hasFacet(Facet.ENUMERATION)) return new ComboField(type, null); - //find LOVscript - Enumeration e = type.getAnnotations(); + //find LOVscript TODO: Implement LOV + Enumeration e = type.getAnnotations(); while (e.hasMoreElements()) { - Annotation note = (Annotation)e.nextElement(); - for (Enumeration f = note.getAppInfo(); f.hasMoreElements();) { - AppInfo thisAppInfo = (AppInfo)f.nextElement(); + Annotation note = e.nextElement(); + for (Enumeration f = note.getAppInfo(); f.hasMoreElements();) { + AppInfo thisAppInfo = f.nextElement(); for (Enumeration g = thisAppInfo.getObjects(); g.hasMoreElements();) { AnyNode appInfoNode = (AnyNode)g.nextElement(); if (appInfoNode.getLocalName().equals("ScriptList") -- cgit v1.2.3