hammant 2003/02/17 13:25:45
Modified: instrument-client altrmiproxies.xml build.xml
default.properties
instrument-client/src/java/org/apache/excalibur/instrument/client
InstrumentManagerConnection.java
InstrumentManagerTree.java
InstrumentManagerTreeModel.java MenuBar.java
Added: instrument-client/lib altrmi-client-impl-0.9.1.jar
altrmi-client-interfaces-0.9.1.jar
altrmi-common-0.9.1.jar altrmi-generator-0.9.1.jar
altrmi-registry-0.9.1.jar
altrmi-server-impl-0.9.1.jar
altrmi-server-interfaces-0.9.1.jar
Log:
AltRMI moved from Excalibur
Revision Changes Path
1.7 +6 -6 avalon-excalibur/instrument-client/altrmiproxies.xml
Index: altrmiproxies.xml
===================================================================
RCS file: /home/cvs/avalon-excalibur/instrument-client/altrmiproxies.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- altrmiproxies.xml 10 Jan 2003 14:57:00 -0000 1.6
+++ altrmiproxies.xml 17 Feb 2003 21:25:44 -0000 1.7
@@ -6,18 +6,18 @@
<path id="project.class.path">
<pathelement location="${build.classes}"/>
<pathelement location="${avalon-framework.jar}"/>
- <pathelement location="${excalibur-altrmi-client-impl.jar}"/>
- <pathelement location="${excalibur-altrmi-client-interfaces.jar}"/>
- <pathelement location="${excalibur-altrmi-server-interfaces.jar}"/>
- <pathelement location="${excalibur-altrmi-common.jar}"/>
- <pathelement location="${excalibur-altrmi-generator.jar}"/>
+ <pathelement location="${altrmi-client-impl.jar}"/>
+ <pathelement location="${altrmi-client-interfaces.jar}"/>
+ <pathelement location="${altrmi-server-interfaces.jar}"/>
+ <pathelement location="${altrmi-common.jar}"/>
+ <pathelement location="${altrmi-generator.jar}"/>
<pathelement location="${excalibur-instrument-manager-interfaces.jar}"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${checkstyle.jar}"/>
</path>
<taskdef name="altrmiproxies"
- classname="org.apache.excalibur.altrmi.generator.ant.ProxyGenerationTask">
+ classname="org.apache.altrmi.generator.ant.ProxyGenerationTask">
<classpath>
<path refid="project.class.path" />
<pathelement path="${build.manager.classes}"/>
1.34 +9 -11 avalon-excalibur/instrument-client/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/avalon-excalibur/instrument-client/build.xml,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- build.xml 10 Feb 2003 15:11:58 -0000 1.33
+++ build.xml 17 Feb 2003 21:25:44 -0000 1.34
@@ -13,10 +13,10 @@
<path id="project.class.path">
<pathelement location="${build.classes}"/>
<pathelement location="${avalon-framework.jar}"/>
- <pathelement location="${excalibur-altrmi-common.jar}"/>
- <pathelement location="${excalibur-altrmi-client-impl.jar}"/>
- <pathelement location="${excalibur-altrmi-client-interfaces.jar}"/>
- <pathelement location="${excalibur-altrmi-generator.jar}"/>
+ <pathelement location="${altrmi-common.jar}"/>
+ <pathelement location="${altrmi-client-impl.jar}"/>
+ <pathelement location="${altrmi-client-interfaces.jar}"/>
+ <pathelement location="${altrmi-generator.jar}"/>
<pathelement location="${excalibur-instrument-manager-interfaces.jar}"/>
<pathelement location="${checkstyle.jar}"/>
<pathelement path="${java.class.path}"/>
@@ -40,8 +40,6 @@
<target name="dependencies" description="Check dependencies"
unless="skip.dependencies">
<ant antfile="${depchecker.prefix}/depchecker.xml" target="checkCommon"/>
<ant antfile="${depchecker.prefix}/depchecker.xml" target="checkFramework"/>
- <ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkAltrmiClient"/>
- <ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkAltrmiGenerator"/>
<ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkInstrumentManagerInterfaces"/>
</target>
@@ -124,7 +122,7 @@
</copy>
</target>
- <!-- Generates the altrmi proxies used by the client. -->
+ <!-- Generates the AltRMI proxies used by the client. -->
<target name="altrmiproxies" depends="compile">
<ant antfile="altrmiproxies.xml" target="altrmiproxies"/>
</target>
@@ -332,10 +330,10 @@
<!-- Instrument Manager Jars -->
<copy file="${excalibur-instrument-manager-interfaces.jar}"
todir="${dist.lib.dir}" preservelastmodified="yes"/>
- <!-- Altrmi Jars -->
- <copy file="${excalibur-altrmi-client-impl.jar}" todir="${dist.lib.dir}"
preservelastmodified="yes"/>
- <copy file="${excalibur-altrmi-client-interfaces.jar}"
todir="${dist.lib.dir}" preservelastmodified="yes"/>
- <copy file="${excalibur-altrmi-common.jar}" todir="${dist.lib.dir}"
preservelastmodified="yes"/>
+ <!-- AltRMI Jars -->
+ <copy file="${altrmi-client-impl.jar}" todir="${dist.lib.dir}"
preservelastmodified="yes"/>
+ <copy file="${altrmi-client-interfaces.jar}" todir="${dist.lib.dir}"
preservelastmodified="yes"/>
+ <copy file="${altrmi-common.jar}" todir="${dist.lib.dir}"
preservelastmodified="yes"/>
</target>
<!-- Creates a minimal distribution -->
1.16 +7 -7 avalon-excalibur/instrument-client/default.properties
Index: default.properties
===================================================================
RCS file: /home/cvs/avalon-excalibur/instrument-client/default.properties,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- default.properties 10 Feb 2003 15:11:58 -0000 1.15
+++ default.properties 17 Feb 2003 21:25:44 -0000 1.16
@@ -29,13 +29,13 @@
avalon-framework.lib=${avalon-framework.home}/target/lib
avalon-framework.jar=${avalon-framework.lib}/avalon-framework.jar
-# ----- Altrmi -----
-excalibur-altrmi.home=${basedir}/../altrmi/dist
-excalibur-altrmi-common.jar=${excalibur-altrmi.home}/excalibur-altrmi-common-0.9.jar
-excalibur-altrmi-client-impl.jar=${excalibur-altrmi.home}/excalibur-altrmi-client-impl-0.9.jar
-excalibur-altrmi-client-interfaces.jar=${excalibur-altrmi.home}/excalibur-altrmi-client-interfaces-0.9.jar
-excalibur-altrmi-server-interfaces.jar=${excalibur-altrmi.home}/excalibur-altrmi-server-interfaces-0.9.jar
-excalibur-altrmi-generator.jar=${excalibur-altrmi.home}/excalibur-altrmi-generator-0.9.jar
+# ----- AltRMI -----
+altrmi.home=${basedir}
+altrmi-common.jar=${altrmi.home}/lib/altrmi-common-0.9.1.jar
+altrmi-client-impl.jar=${altrmi.home}/lib/altrmi-client-impl-0.9.1.jar
+altrmi-client-interfaces.jar=${altrmi.home}/lib/altrmi-client-interfaces-0.9.1.jar
+altrmi-server-interfaces.jar=${altrmi.home}/lib/altrmi-server-interfaces-0.9.1.jar
+altrmi-generator.jar=${altrmi.home}/lib/altrmi-generator-0.9.1.jar
# ----- Excalibur instrument-manager -----
excalibur-instrument-manager.home=${basedir}/../instrument-manager/dist
1.14 +10 -10
avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client/InstrumentManagerConnection.java
Index: InstrumentManagerConnection.java
===================================================================
RCS file:
/home/cvs/avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client/InstrumentManagerConnection.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- InstrumentManagerConnection.java 9 Jan 2003 22:56:50 -0000 1.13
+++ InstrumentManagerConnection.java 17 Feb 2003 21:25:44 -0000 1.14
@@ -33,14 +33,14 @@
import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
-import org.apache.excalibur.altrmi.client.HostContext;
-import org.apache.excalibur.altrmi.client.Factory;
-import org.apache.excalibur.altrmi.client.impl.socket.SocketCustomStreamHostContext;
-import org.apache.excalibur.altrmi.client.impl.ClientSideClassFactory;
-import org.apache.excalibur.altrmi.client.impl.DefaultConnectionListener;
-import org.apache.excalibur.altrmi.common.ConnectionException;
-import org.apache.excalibur.altrmi.common.InvocationException;
-import org.apache.excalibur.altrmi.common.ConnectionRefusedException;
+import org.apache.altrmi.client.HostContext;
+import org.apache.altrmi.client.Factory;
+import org.apache.altrmi.client.impl.socket.SocketCustomStreamHostContext;
+import org.apache.altrmi.client.impl.ClientSideClassFactory;
+import org.apache.altrmi.client.impl.DefaultClientMonitor;
+import org.apache.altrmi.common.ConnectionException;
+import org.apache.altrmi.common.InvocationException;
+import org.apache.altrmi.common.ConnectionRefusedException;
import org.apache.excalibur.instrument.manager.interfaces.InstrumentableDescriptor;
import org.apache.excalibur.instrument.manager.interfaces.InstrumentDescriptor;
@@ -364,7 +364,7 @@
SocketCustomStreamHostContext altrmiHostContext =
new SocketCustomStreamHostContext( m_host, m_port );
- altrmiHostContext.setConnectionListener( new DefaultConnectionListener( 0 )
);
+ altrmiHostContext.setClientMonitor( new DefaultClientMonitor( 0 ) );
m_altrmiHostContext = altrmiHostContext;
m_altrmiFactory = new ClientSideClassFactory( false );
1.3 +17 -17
avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client/InstrumentManagerTree.java
Index: InstrumentManagerTree.java
===================================================================
RCS file:
/home/cvs/avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client/InstrumentManagerTree.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- InstrumentManagerTree.java 5 Jan 2003 23:28:07 -0000 1.2
+++ InstrumentManagerTree.java 17 Feb 2003 21:25:45 -0000 1.3
@@ -24,26 +24,26 @@
import org.apache.excalibur.instrument.manager.interfaces.InstrumentManagerClient;
-import org.apache.excalibur.altrmi.common.InvocationException;
+import org.apache.altrmi.common.InvocationException;
class InstrumentManagerTree
extends JComponent
{
private final InstrumentManagerConnection m_connection;
-
+
private final TreeModel m_treeModel;
private final JTree m_tree;
-
+
/*---------------------------------------------------------------
* Constructors
*-------------------------------------------------------------*/
InstrumentManagerTree( InstrumentManagerConnection connection )
{
m_connection = connection;
-
+
m_treeModel = m_connection.getTreeModel();
-
-
+
+
m_tree = new JTree( m_treeModel );
//m_tree.setEditable( true ); // Makes it possible to edit the node names
in line.
m_tree.getSelectionModel().setSelectionMode(
TreeSelectionModel.SINGLE_TREE_SELECTION );
@@ -51,7 +51,7 @@
m_tree.setShowsRootHandles( true ); // The root's children become "roots"
m_tree.setCellRenderer( new InstrumentManagerTreeCellRenderer() );
m_tree.putClientProperty( "JTree.lineStyle", "Angled" );
-
+
m_tree.addMouseListener( new MouseAdapter()
{
public void mouseClicked( MouseEvent event )
@@ -96,16 +96,16 @@
}
}
});
-
+
// Register the tree to work with tooltips.
ToolTipManager.sharedInstance().registerComponent( m_tree );
-
+
JScrollPane scrollPane = new JScrollPane( m_tree );
-
+
setLayout( new BorderLayout() );
add( scrollPane, BorderLayout.CENTER );
}
-
+
/*---------------------------------------------------------------
* Methods
*-------------------------------------------------------------*/
@@ -114,7 +114,7 @@
ToolTipManager.sharedInstance().unregisterComponent( m_tree );
m_tree.setModel( null );
}
-
+
private void nodeSelected( int row )
{
TreePath treePath = m_tree.getPathForRow( row );
@@ -128,11 +128,11 @@
}
}
}
-
+
private void showNodePopup( int row, int mouseX, int mouseY )
{
TreePath treePath = m_tree.getPathForRow( row );
-
+
if ( treePath.getLastPathComponent() instanceof DefaultMutableTreeNode )
{
DefaultMutableTreeNode treeNode =
(DefaultMutableTreeNode)treePath.getLastPathComponent();
@@ -144,17 +144,17 @@
{
// Need to figure out where to display the popup.
Rectangle bounds = m_tree.getRowBounds( row );
-
+
/*
// Anchor the popup menu at the location of the node.
int x = bounds.x + 24;
int y = bounds.y + bounds.height;
*/
-
+
// Anchor the popup menu where the user clicked.
int x = mouseX;
int y = mouseY;
-
+
popup.show( m_tree, x, y );
}
}
1.7 +84 -84
avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client/InstrumentManagerTreeModel.java
Index: InstrumentManagerTreeModel.java
===================================================================
RCS file:
/home/cvs/avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client/InstrumentManagerTreeModel.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- InstrumentManagerTreeModel.java 5 Jan 2003 23:28:07 -0000 1.6
+++ InstrumentManagerTreeModel.java 17 Feb 2003 21:25:45 -0000 1.7
@@ -27,44 +27,44 @@
import org.apache.excalibur.instrument.manager.interfaces.InstrumentManagerClient;
import
org.apache.excalibur.instrument.manager.interfaces.InstrumentSampleDescriptor;
-import org.apache.excalibur.altrmi.common.InvocationException;
+import org.apache.altrmi.common.InvocationException;
class InstrumentManagerTreeModel
extends AbstractLogEnabled
implements InstrumentManagerConnectionListener, TreeModel
{
private final InstrumentManagerConnection m_connection;
-
+
/** The last InstrumentManagerClient referenced. Used to tell when it changes.
*/
private InstrumentManagerClient m_lastClient;
-
+
/** The state version of the last client. */
private int m_lastClientStateVersion;
private DefaultMutableTreeNode m_root;
-
+
private ArrayList m_listeners = new ArrayList();
private TreeModelListener[] m_listenerArray;
-
+
private HashMap m_elementMap = new HashMap();
private HashMap m_leasedSampleMap = new HashMap();
private DefaultMutableTreeNode[] m_leasedSampleArray;
-
+
/*---------------------------------------------------------------
* Constructors
*-------------------------------------------------------------*/
InstrumentManagerTreeModel( InstrumentManagerConnection connection )
{
m_connection = connection;
-
+
m_root = new DefaultMutableTreeNode( "Root" );
}
-
+
/*---------------------------------------------------------------
* InstrumentManagerConnectionListener Methods
*-------------------------------------------------------------*/
/**
- * Called when the connection is opened. May be called more than once if
+ * Called when the connection is opened. May be called more than once if
* the connection to the InstrumentManager is reopened.
*
* @param connection Connection which was opened.
@@ -74,9 +74,9 @@
//getLogger.debug("InstrumentManagerTreeModel.opened(" + connection + ")");
refreshModel();
}
-
+
/**
- * Called when the connection is closed. May be called more than once if
+ * Called when the connection is closed. May be called more than once if
* the connection to the InstrumentManager is reopened.
*
* @param connection Connection which was closed.
@@ -86,7 +86,7 @@
//getLogger.debug("InstrumentManagerTreeModel.closed(" + connection + ")");
refreshModel();
}
-
+
/**
* Called when the connection is deleted. All references should be removed.
*
@@ -97,7 +97,7 @@
//getLogger.debug("InstrumentManagerTreeModel.deleted(" + connection + ")");
refreshModel();
}
-
+
/*---------------------------------------------------------------
* TreeModel Methods
*-------------------------------------------------------------*/
@@ -111,7 +111,7 @@
{
return m_root;
}
-
+
/**
* Returns the child of <I>parent</I> at index <I>index</I> in the parent's
* child array. <I>parent</I> must be a node previously obtained from
@@ -135,8 +135,8 @@
return "---";
}
}
-
-
+
+
/**
* Returns the number of children of <I>parent</I>. Returns 0 if the node
* is a leaf or if it has no children. <I>parent</I> must be a node
@@ -158,7 +158,7 @@
return 0;
}
}
-
+
/**
* Returns true if <I>node</I> is a leaf. It is possible for this method
* to return false even if <I>node</I> has no children. A directory in a
@@ -187,7 +187,7 @@
return true;
}
}
-
+
/**
* Messaged when the user has altered the value for the item identified
* by <I>path</I> to <I>newValue</I>. If <I>newValue</I> signifies
@@ -202,7 +202,7 @@
//getLogger.debug( "InstrumentManagerTreeModel.valueForPathChanged(" + path
+
// ", " + newValue + ")" );
}
-
+
/**
* Returns the index of child in parent.
*/
@@ -219,7 +219,7 @@
return 0;
}
}
-
+
/**
* Adds a listener for the TreeModelEvent posted after the tree changes.
*
@@ -234,12 +234,12 @@
m_listenerArray = null;
}
}
-
+
/**
* Removes a listener previously added with <B>addTreeModelListener()</B>.
*
* @param listener the listener to remove
- */
+ */
public void removeTreeModelListener( TreeModelListener listener )
{
//getLogger.debug("InstrumentManagerTreeModel.removeTreeModelListener(" +
listener + ")");
@@ -273,7 +273,7 @@
}
return listeners;
}
-
+
private void fireTreeNodesChanged( TreeModelEvent event )
{
TreeModelListener[] listeners = getListeners();
@@ -282,7 +282,7 @@
listeners[i].treeNodesChanged( event );
}
}
-
+
private void fireTreeNodesInserted( TreeModelEvent event )
{
TreeModelListener[] listeners = getListeners();
@@ -291,7 +291,7 @@
listeners[i].treeNodesInserted( event );
}
}
-
+
private void fireTreeNodesRemoved( TreeModelEvent event )
{
TreeModelListener[] listeners = getListeners();
@@ -300,7 +300,7 @@
listeners[i].treeNodesRemoved( event );
}
}
-
+
private void fireTreeStructureChanged( TreeModelEvent event )
{
TreeModelListener[] listeners = getListeners();
@@ -330,7 +330,7 @@
}
return null;
}
-
+
/**
* Returns a TreeNode for an Instrument given its name.
*
@@ -351,7 +351,7 @@
}
return null;
}
-
+
/**
* Returns a TreeNode for an InstrumentSample given its name.
*
@@ -372,7 +372,7 @@
}
return null;
}
-
+
/**
* Returns an optimized array of TreeNodes representing the leased
* instrument samples in this tree model.
@@ -394,7 +394,7 @@
}
return leasedSampleArray;
}
-
+
/**
* Once a minute, all of the leased samples should be updated. This is
* necessary to get the latest expiration times in case other processes
@@ -404,25 +404,25 @@
void renewAllSampleLeases()
{
DefaultMutableTreeNode[] leasedSampleArray = getLeasedSampleArray();
-
+
for ( int i = 0; i < leasedSampleArray.length; i++ )
{
// Extract the NodeData from the TreeNode
InstrumentSampleNodeData sampleNodeData =
(InstrumentSampleNodeData)leasedSampleArray[i].getUserObject();
InstrumentSampleDescriptor sampleDescriptor =
sampleNodeData.getDescriptor();
-
+
updateInstrumentSample( sampleDescriptor );
}
}
-
+
/**
* Remove any instrument samples whose current leases have expired.
*/
void purgeExpiredSamples()
{
DefaultMutableTreeNode[] leasedSampleArray = getLeasedSampleArray();
-
+
for ( int i = 0; i < leasedSampleArray.length; i++ )
{
// Extract the NodeData from the TreeNode
@@ -441,7 +441,7 @@
}
}
}
-
+
/**
* Refreshes the entire Tree Model with the latest information from the server.
* This should be called whenever a refresh is needed, or whenever the status
@@ -479,7 +479,7 @@
m_lastClientStateVersion = -1;
fireTreeStructureChanged( new TreeModelEvent( this, new Object[] {
m_root } ) );
}
-
+
// Need to update the child nodes. (Root Instrumentables)
try
{
@@ -494,7 +494,7 @@
}
m_lastClient = client;
}
-
+
/**
* Called to update the local view of the InstrumentManagerClient in the
TreeeModel.
*
@@ -512,13 +512,13 @@
// Already up to date.
return;
}
-
+
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "update client(" + client.getName() + ") "
+ "state new=" + stateVersion + ", old=" + oldStateVersion );
}
-
+
// The latest Instrumentables will be in the correct order.
InstrumentableDescriptor[] descriptors =
client.getInstrumentableDescriptors();
int i;
@@ -532,7 +532,7 @@
{
int cmp;
do {
- DefaultMutableTreeNode oldChild =
+ DefaultMutableTreeNode oldChild =
(DefaultMutableTreeNode)rootTreeNode.getChildAt( i );
cmp =
((InstrumentableNodeData)oldChild.getUserObject()).getDescription().
compareTo( descriptor.getDescription() );
@@ -549,7 +549,7 @@
rootTreeNode.getPath(), new int[] { i }, new
Object[] { oldChild } ) );
}
newChild = oldChild;
-
+
// Node already in the elementMap
}
else if ( cmp > 0 )
@@ -560,7 +560,7 @@
rootTreeNode.insert( newChild, i );
fireTreeNodesInserted( new TreeModelEvent( this,
rootTreeNode.getPath(),new int[] { i }, new Object[] {
newChild } ) );
-
+
// Add the new node to the elementMap
m_elementMap.put(
((InstrumentableNodeData)newChild.getUserObject()).
getName(), newChild );
@@ -571,7 +571,7 @@
rootTreeNode.remove( i );
fireTreeNodesRemoved( new TreeModelEvent( this,
rootTreeNode.getPath(), new int[] { i }, new Object[] {
oldChild } ) );
-
+
// Remove the old node from the elementMap
m_elementMap.remove(
((InstrumentableNodeData)oldChild.getUserObject()).
getName() );
@@ -586,12 +586,12 @@
rootTreeNode.insert( newChild, i );
fireTreeNodesInserted( new TreeModelEvent( this,
rootTreeNode.getPath(),
new int[] { i }, new Object[] { newChild } ) );
-
+
// Add the new node to the elementMap
m_elementMap.put(
((InstrumentableNodeData)newChild.getUserObject()).
getName(), newChild );
}
-
+
updateInstrumentable( descriptor, newChild,
oldInstrumentableStateVersion );
}
// Remove any remaining old nodes
@@ -602,12 +602,12 @@
rootTreeNode.remove( i );
fireTreeNodesRemoved( new TreeModelEvent(
this, rootTreeNode.getPath(), new int[] { i }, new Object[] {
oldChild } ) );
-
+
// Remove the old node from the elementMap
m_elementMap.remove( ((InstrumentableNodeData)oldChild.getUserObject()).
getName() );
}
-
+
m_lastClientStateVersion = stateVersion;
}
@@ -628,13 +628,13 @@
// Already up to date.
return;
}
-
+
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "update instrumentable(" +
instrumentableDescriptor.getName() + ") "
+ "state new=" + stateVersion + ", old=" + oldStateVersion );
}
-
+
// The latest Instrumentables will be in the correct order.
InstrumentableDescriptor[] descriptors =
instrumentableDescriptor.getChildInstrumentableDescriptors();
@@ -651,7 +651,7 @@
{
int cmp;
do {
- DefaultMutableTreeNode oldChild =
+ DefaultMutableTreeNode oldChild =
(DefaultMutableTreeNode)instrumentableTreeNode.getChildAt(
i );
if ( oldChild.getUserObject() instanceof InstrumentableNodeData
)
{
@@ -663,7 +663,7 @@
// Always put Instrumentables before any other nodes.
cmp = 1;
}
-
+
if ( cmp == 0 )
{
// This is the same object.
@@ -678,7 +678,7 @@
new Object[] { oldChild } ) );
}
newChild = oldChild;
-
+
// Node already in the elementMap
}
else if ( cmp > 0 )
@@ -690,7 +690,7 @@
fireTreeNodesInserted( new TreeModelEvent( this,
instrumentableTreeNode.getPath(),new int[] { i },
new Object[] { newChild } ) );
-
+
// Add the new node to the elementMap
m_elementMap.put(
((InstrumentableNodeData)newChild.getUserObject()).
getName(), newChild );
@@ -702,7 +702,7 @@
fireTreeNodesRemoved( new TreeModelEvent( this,
instrumentableTreeNode.getPath(), new int[] { i },
new Object[] { oldChild } ) );
-
+
// Remove the old node from the elementMap
m_elementMap.remove(
((InstrumentableNodeData)oldChild.getUserObject()).
getName() );
@@ -717,12 +717,12 @@
instrumentableTreeNode.insert( newChild, i );
fireTreeNodesInserted( new TreeModelEvent( this,
instrumentableTreeNode.getPath(),
new int[] { i }, new Object[] { newChild } ) );
-
+
// Add the new node to the elementMap
m_elementMap.put(
((InstrumentableNodeData)newChild.getUserObject()).
getName(), newChild );
}
-
+
updateInstrumentable( descriptor, newChild,
oldInstrumentableStateVersion );
}
// Remove any remaining old Instrumentable nodes
@@ -735,18 +735,18 @@
{
break;
}
-
+
instrumentableTreeNode.remove( i );
fireTreeNodesRemoved( new TreeModelEvent(
this, instrumentableTreeNode.getPath(), new int[] { i },
new Object[] { oldChild } ) );
-
+
// Remove the old node from the elementMap
m_elementMap.remove( ((InstrumentableNodeData)oldChild.getUserObject()).
getName() );
}
-
-
+
+
// The latest Instruments will be in the correct order.
InstrumentDescriptor[] instrumentDescriptors =
instrumentableDescriptor.getInstrumentDescriptors();
@@ -761,7 +761,7 @@
{
int cmp;
do {
- DefaultMutableTreeNode oldChild =
+ DefaultMutableTreeNode oldChild =
(DefaultMutableTreeNode)instrumentableTreeNode.getChildAt(
i );
if ( oldChild.getUserObject() instanceof InstrumentNodeData )
{
@@ -773,7 +773,7 @@
// Always put Instrumentables before any other nodes.
cmp = 1;
}
-
+
if ( cmp == 0 )
{
// This is the same object.
@@ -787,7 +787,7 @@
new Object[] { oldChild } ) );
}
newChild = oldChild;
-
+
// Node already in the elementMap
}
else if ( cmp > 0 )
@@ -799,7 +799,7 @@
fireTreeNodesInserted( new TreeModelEvent( this,
instrumentableTreeNode.getPath(),new int[] { i },
new Object[] { newChild } ) );
-
+
// Add the new node to the elementMap
m_elementMap.put(
((InstrumentNodeData)newChild.getUserObject()).
getName(), newChild );
@@ -811,7 +811,7 @@
fireTreeNodesRemoved( new TreeModelEvent( this,
instrumentableTreeNode.getPath(), new int[] { i },
new Object[] { oldChild } ) );
-
+
// Remove the old node from the elementMap
m_elementMap.remove(
((InstrumentNodeData)oldChild.getUserObject()).
getName() );
@@ -826,12 +826,12 @@
instrumentableTreeNode.insert( newChild, i );
fireTreeNodesInserted( new TreeModelEvent( this,
instrumentableTreeNode.getPath(),
new int[] { i }, new Object[] { newChild } ) );
-
+
// Add the new node to the elementMap
m_elementMap.put( ((InstrumentNodeData)newChild.getUserObject()).
getName(), newChild );
}
-
+
updateInstrument( descriptor, newChild, oldInstrumentStateVersion );
}
// Remove any remaining old Instrument nodes
@@ -844,13 +844,13 @@
fireTreeNodesRemoved( new TreeModelEvent(
this, instrumentableTreeNode.getPath(), new int[] { i },
new Object[] { oldChild } ) );
-
+
// Remove the old node from the elementMap
m_elementMap.remove( ((InstrumentNodeData)oldChild.getUserObject()).
getName() );
}
}
-
+
/**
* @param instrumentDescriptor The descriptor of the Instrument to update.
*/
@@ -864,7 +864,7 @@
updateInstrument( instrumentDescriptor, instrumentTreeNode, -1 /* Force
update */ );
}
}
-
+
/**
* @param instrumentDescriptor The descriptor of the Instrument to update.
* @param instrumentTreeNode The tree node of the Instrument to update.
@@ -879,13 +879,13 @@
// Already up to date.
return;
}
-
+
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "update instrument(" +
instrumentDescriptor.getName() + ") "
+ "state new=" + stateVersion + ", old=" + oldStateVersion );
}
-
+
// The latest Instrument Samples will be in the correct order.
InstrumentSampleDescriptor[] descriptors =
instrumentDescriptor.getInstrumentSampleDescriptors();
@@ -901,7 +901,7 @@
{
int cmp;
do {
- DefaultMutableTreeNode oldChild =
+ DefaultMutableTreeNode oldChild =
(DefaultMutableTreeNode)instrumentTreeNode.getChildAt( i );
if ( oldChild.getUserObject() instanceof
InstrumentSampleNodeData )
{
@@ -913,7 +913,7 @@
// Always put Instrumentables before any other nodes.
cmp = 1;
}
-
+
if ( cmp == 0 )
{
// This is the same object.
@@ -925,7 +925,7 @@
new Object[] { oldChild } ) );
}
newChild = oldChild;
-
+
// Node already in the elementMap
}
else if ( cmp > 0 )
@@ -938,7 +938,7 @@
fireTreeNodesInserted( new TreeModelEvent( this,
instrumentTreeNode.getPath(),new int[] { i },
new Object[] { newChild } ) );
-
+
// Add the new node to the elementMap
InstrumentSampleNodeData newNodeData =
(InstrumentSampleNodeData)newChild.getUserObject();
@@ -949,7 +949,7 @@
m_leasedSampleMap.put( sampleName, newChild );
m_leasedSampleArray = null;
}
-
+
// Make sure that the maintained flag is set correctly
MaintainedSampleLease lease =
m_connection.getMaintainedSampleLease( sampleName );
@@ -965,7 +965,7 @@
fireTreeNodesRemoved( new TreeModelEvent( this,
instrumentTreeNode.getPath(), new int[] { i },
new Object[] { oldChild } ) );
-
+
// Remove the old node from the elementMap
InstrumentSampleNodeData oldNodeData =
(InstrumentSampleNodeData)oldChild.getUserObject();
@@ -988,7 +988,7 @@
instrumentTreeNode.insert( newChild, i );
fireTreeNodesInserted( new TreeModelEvent( this,
instrumentTreeNode.getPath(),
new int[] { i }, new Object[] { newChild } ) );
-
+
// Add the new node to the elementMap
InstrumentSampleNodeData newNodeData =
(InstrumentSampleNodeData)newChild.getUserObject();
@@ -999,7 +999,7 @@
m_leasedSampleMap.put( sampleName, newChild );
m_leasedSampleArray = null;
}
-
+
// Make sure that the maintained flag is set correctly
MaintainedSampleLease lease =
m_connection.getMaintainedSampleLease( sampleName );
@@ -1019,12 +1019,12 @@
{
break;
}
-
+
instrumentTreeNode.remove( i );
fireTreeNodesRemoved( new TreeModelEvent(
this, instrumentTreeNode.getPath(), new int[] { i },
new Object[] { oldChild } ) );
-
+
// Remove the old node from the elementMap
InstrumentSampleNodeData oldNodeData =
(InstrumentSampleNodeData)oldChild.getUserObject();
@@ -1052,7 +1052,7 @@
updateInstrumentSample( sampleDescriptor, sampleTreeNode );
}
}
-
+
/**
* @param sampleDescriptor The descriptor of the Instrument Sample to
* update.
@@ -1063,7 +1063,7 @@
{
// An update here should always lead to an event being fired.
((InstrumentSampleNodeData)sampleTreeNode.getUserObject()).update();
-
+
// The contents of the node changed.
fireTreeNodesChanged( new TreeModelEvent( this,
sampleTreeNode.getPath(), new int[ 0 ], new Object[ 0 ] ) );
1.5 +63 -63
avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client/MenuBar.java
Index: MenuBar.java
===================================================================
RCS file:
/home/cvs/avalon-excalibur/instrument-client/src/java/org/apache/excalibur/instrument/client/MenuBar.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MenuBar.java 5 Jan 2003 23:28:07 -0000 1.4
+++ MenuBar.java 17 Feb 2003 21:25:45 -0000 1.5
@@ -25,7 +25,7 @@
import org.apache.excalibur.instrument.manager.interfaces.InstrumentManagerClient;
import
org.apache.excalibur.instrument.manager.interfaces.InstrumentSampleDescriptor;
-import org.apache.excalibur.altrmi.common.InvocationException;
+import org.apache.altrmi.common.InvocationException;
/**
*
@@ -71,8 +71,8 @@
{
m_menuFile = (JMenu)new LargeMenu( "File" );
m_menuFile.setMnemonic( 'F' );
-
-
+
+
// Clear
Action newAction = new AbstractAction( "New" )
{
@@ -84,8 +84,8 @@
JMenuItem newItem = new JMenuItem( newAction );
newItem.setMnemonic( 'N' );
m_menuFile.add( newItem );
-
-
+
+
// Open
Action openAction = new AbstractAction( "Open ..." )
{
@@ -97,12 +97,12 @@
JMenuItem open = new JMenuItem( openAction );
open.setMnemonic( 'O' );
m_menuFile.add( open );
-
-
+
+
// Seperator
m_menuFile.addSeparator();
-
-
+
+
// Save
Action saveAction = new AbstractAction( "Save" )
{
@@ -114,8 +114,8 @@
JMenuItem save = new JMenuItem( saveAction );
save.setMnemonic( 'S' );
m_menuFile.add( save );
-
-
+
+
// Save As
Action saveAsAction = new AbstractAction( "Save As ..." )
{
@@ -127,12 +127,12 @@
JMenuItem saveAs = new JMenuItem( saveAsAction );
saveAs.setMnemonic( 'A' );
m_menuFile.add( saveAs );
-
-
+
+
// Seperator
m_menuFile.addSeparator();
-
+
// Exit
Action exitAction = new AbstractAction( "Exit" )
{
@@ -144,7 +144,7 @@
JMenuItem exit = new JMenuItem( exitAction );
exit.setMnemonic( 'X' );
m_menuFile.add( exit );
-
+
return m_menuFile;
}
@@ -171,11 +171,11 @@
return m_menuInstrumentManagers;
}
-
+
private void rebuildInstrumentManagersMenu()
{
m_menuInstrumentManagers.removeAll();
-
+
// Add Connect menu item
Action connectAction = new AbstractAction( "Connect to Instrument
Manager..." )
{
@@ -185,21 +185,21 @@
m_frame.showConnectDialog();
}
};
-
+
JMenuItem connectItem = new JMenuItem( connectAction );
connectItem.setMnemonic( 'C' );
m_menuInstrumentManagers.add( connectItem );
-
+
// Add links to the connections
InstrumentManagerConnection[] connections =
m_frame.getInstrumentManagerConnections();
if ( connections.length > 0 )
{
m_menuInstrumentManagers.addSeparator();
-
+
for ( int i = 0; i < connections.length; i++ )
{
InstrumentManagerConnection connection = connections[i];
-
+
Action action = new AbstractAction( connection.getTitle() )
{
public void actionPerformed( ActionEvent event )
@@ -207,7 +207,7 @@
}
};
action.putValue( "InstrumentManagerConnection", connection );
-
+
JMenu menu = new LargeMenu( action );
// Set up a Listener to handle the selected event.
@@ -217,7 +217,7 @@
{
JMenu menu = (JMenu)event.getSource();
Action action = menu.getAction();
-
+
rebuildInstrumentManagerMenu(
menu, (InstrumentManagerConnection)action.getValue(
"InstrumentManagerConnection" ) );
@@ -241,9 +241,9 @@
InstrumentManagerConnection
connection )
{
managerMenu.removeAll();
-
+
boolean showAll = m_menuItemShowUnconfigured.getState();
-
+
// Delete
Action deleteAction = new AbstractAction( "Delete" )
{
@@ -251,39 +251,39 @@
{
JMenuItem item = (JMenuItem)event.getSource();
Action action = item.getAction();
-
+
InstrumentManagerConnection connection =
(InstrumentManagerConnection)action.getValue(
"InstrumentManagerConnection" );
-
+
connection.delete();
}
};
deleteAction.putValue( "InstrumentManagerConnection", connection );
-
+
JMenuItem deleteItem = new JMenuItem( deleteAction );
deleteItem.setMnemonic( 'I' );
managerMenu.add( deleteItem );
-
-
+
+
// Instrument menu items
try
{
InstrumentManagerClient manager =
connection.getInstrumentManagerClient();
-
+
if ( manager != null )
{
managerMenu.addSeparator();
-
+
InstrumentableDescriptor[] descriptors =
manager.getInstrumentableDescriptors();
-
+
for( int i = 0; i < descriptors.length; i++ )
{
InstrumentableDescriptor descriptor = descriptors[ i ];
-
+
if( showAll || descriptor.isConfigured() )
{
String description = descriptor.getDescription();
-
+
Action action = new AbstractAction( description )
{
public void actionPerformed( ActionEvent event )
@@ -292,9 +292,9 @@
};
action.putValue( "InstrumentManagerConnection", connection
);
action.putValue( "InstrumentableDescriptor", descriptor );
-
+
JMenu menu = new LargeMenu( action );
-
+
// Set up a Listener to handle the selected event.
menu.addMenuListener( new MenuListener()
{
@@ -302,7 +302,7 @@
{
JMenu menu = (JMenu)event.getSource();
Action action = menu.getAction();
-
+
rebuildInstrumentableMenu(
menu,
(InstrumentManagerConnection)action.getValue(
@@ -310,16 +310,16 @@
(InstrumentableDescriptor)action.getValue(
"InstrumentableDescriptor" ) );
}
-
+
public void menuDeselected( MenuEvent event )
{
}
-
+
public void menuCanceled( MenuEvent event )
{
}
} );
-
+
managerMenu.add( menu );
}
}
@@ -339,20 +339,20 @@
instrumentableMenu.removeAll();
boolean showAll = m_menuItemShowUnconfigured.getState();
-
+
try
{
InstrumentDescriptor[] descriptors =
instrumentableDescriptor.getInstrumentDescriptors();
-
+
for( int i = 0; i < descriptors.length; i++ )
{
InstrumentDescriptor descriptor = descriptors[ i ];
-
+
if( showAll || descriptor.isConfigured() )
{
String description = descriptor.getDescription();
-
+
Action action = new AbstractAction( description )
{
public void actionPerformed( ActionEvent event )
@@ -362,9 +362,9 @@
action.putValue( "InstrumentManagerConnection", connection );
action.putValue( "InstrumentableDescriptor",
instrumentableDescriptor );
action.putValue( "InstrumentDescriptor", descriptor );
-
+
JMenu menu = new LargeMenu( action );
-
+
// Set up a Listener to handle the selected event.
menu.addMenuListener( new MenuListener()
{
@@ -372,7 +372,7 @@
{
JMenu menu = (JMenu)event.getSource();
Action action = menu.getAction();
-
+
rebuildInstrumentMenu(
menu,
(InstrumentManagerConnection)action.getValue(
@@ -382,16 +382,16 @@
(InstrumentDescriptor)action.getValue(
"InstrumentDescriptor" ) );
}
-
+
public void menuDeselected( MenuEvent event )
{
}
-
+
public void menuCanceled( MenuEvent event )
{
}
} );
-
+
instrumentableMenu.add( menu );
}
}
@@ -411,7 +411,7 @@
instrumentMenu.removeAll();
boolean showAll = m_menuItemShowUnconfigured.getState();
-
+
// Create Sample
Action createAction = new AbstractAction( "Create Sample..." )
{
@@ -419,7 +419,7 @@
{
JMenuItem item = (JMenuItem)event.getSource();
Action action = item.getAction();
-
+
/*
m_frame.instrumentCreateSample(
(InstrumentManagerConnection)action.getValue(
"InstrumentManagerConnection" ),
@@ -430,35 +430,35 @@
createAction.putValue( "InstrumentManagerConnection", connection );
createAction.putValue( "InstrumentableDescriptor", instrumentableDescriptor
);
createAction.putValue( "InstrumentDescriptor", instrumentDescriptor );
-
+
JMenuItem createItem = new JMenuItem( createAction );
createItem.setMnemonic( 'C' );
instrumentMenu.add( createItem );
-
+
try
{
InstrumentSampleDescriptor[] descriptors =
instrumentDescriptor.getInstrumentSampleDescriptors();
-
+
if ( descriptors.length > 0 )
{
instrumentMenu.addSeparator();
-
+
for( int i = 0; i < descriptors.length; i++ )
{
InstrumentSampleDescriptor descriptor = descriptors[ i ];
-
+
if( showAll || descriptor.isConfigured() )
{
String description = descriptor.getDescription();
-
+
Action action = new AbstractAction( description )
{
public void actionPerformed( ActionEvent event )
{
JMenuItem menu = (JMenuItem)event.getSource();
Action action = menu.getAction();
-
+
/*
m_frame.openInstrumentSampleFrame(
(InstrumentManagerConnection)action.getValue(
@@ -470,9 +470,9 @@
};
action.putValue( "InstrumentManagerConnection", connection
);
action.putValue( "InstrumentSampleDescriptor", descriptor );
-
+
JMenuItem item = new JMenuItem( action );
-
+
instrumentMenu.add( item );
}
}
1.1
avalon-excalibur/instrument-client/lib/altrmi-client-impl-0.9.1.jar
<<Binary file>>
1.1
avalon-excalibur/instrument-client/lib/altrmi-client-interfaces-0.9.1.jar
<<Binary file>>
1.1 avalon-excalibur/instrument-client/lib/altrmi-common-0.9.1.jar
<<Binary file>>
1.1
avalon-excalibur/instrument-client/lib/altrmi-generator-0.9.1.jar
<<Binary file>>
1.1 avalon-excalibur/instrument-client/lib/altrmi-registry-0.9.1.jar
<<Binary file>>
1.1
avalon-excalibur/instrument-client/lib/altrmi-server-impl-0.9.1.jar
<<Binary file>>
1.1
avalon-excalibur/instrument-client/lib/altrmi-server-interfaces-0.9.1.jar
<<Binary file>>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]