mc4j-cvs Mailing List for MC4J JMX Console (Page 31)
Brought to you by:
ghinkl
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(7) |
Apr
(135) |
May
(32) |
Jun
(34) |
Jul
|
Aug
|
Sep
(7) |
Oct
(139) |
Nov
(11) |
Dec
(5) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(34) |
Feb
(1) |
Mar
(12) |
Apr
|
May
(87) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(27) |
Nov
(49) |
Dec
(13) |
2006 |
Jan
|
Feb
|
Mar
|
Apr
(252) |
May
(16) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(3) |
Oct
|
Nov
(1) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
(2) |
Jul
(15) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(6) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
(1) |
Nov
|
Dec
|
From: Greg H. <gh...@us...> - 2004-05-26 02:51:31
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/proxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20039/src/org/mc4j/console/connection/proxy Modified Files: JMXRemotingMBeanServerProxy.java Log Message: Fix for bugs #939971, #914838, #957714, #933080 Based on patches submitted by holbitlan. Now removes mbeans from the tree when they are unregistered from the server. This is based on the 10 second, delayed refresh thread. (Not removing beans from dashboard attribute table components on unregister yet as this can cause problems depending on the dashboard match section) Index: JMXRemotingMBeanServerProxy.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/proxy/JMXRemotingMBeanServerProxy.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JMXRemotingMBeanServerProxy.java 19 May 2004 14:47:01 -0000 1.3 --- JMXRemotingMBeanServerProxy.java 26 May 2004 02:51:22 -0000 1.4 *************** *** 20,23 **** --- 20,27 ---- package org.mc4j.console.connection.proxy; + import org.openide.ErrorManager; + + import org.mc4j.console.swing.SwingUtility; + import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; *************** *** 33,40 **** import javax.management.QueryExp; - import org.openide.ErrorManager; - - import org.mc4j.console.swing.SwingUtility; - /** --- 37,40 ---- *************** *** 77,80 **** --- 77,82 ---- } else if (m.getName().equals("invoke")) { return this.remoteServer.invoke((ObjectName) args[0], (String) args[1], (Object[]) args[2],(String[]) args[3]); + } else if (m.getName().equals("isRegistered")) { + return this.remoteServer.isRegistered((ObjectName) args[0]) ? Boolean.TRUE : Boolean.FALSE; } else if (m.getName().equals("addNotificationListener")) { this.remoteServer.addNotificationListener((ObjectName) args[0], (NotificationListener) args[1], (NotificationFilter) args[2],(Object) args[3]); *************** *** 89,92 **** --- 91,106 ---- this.remoteServer.setAttributes((ObjectName) args[0], (AttributeList) args[1]); return null; + } else if (m.getName().equals("getDefaultDomain")) { + return this.remoteServer.getDefaultDomain(); + } else if (m.getName().equals("createMBean")) { + if (args.length == 2) { + return this.remoteServer.createMBean((String) args[0], (ObjectName) args[1]); + } else if (args.length == 3) { + return this.remoteServer.createMBean((String) args[0], (ObjectName) args[1], (ObjectName) args[2]); + } else if (args.length == 4) { + return this.remoteServer.createMBean((String) args[0], (ObjectName) args[1], (Object[]) args[2], (String[]) args[3]); + } else if (args.length == 5) { + return this.remoteServer.createMBean((String) args[0], (ObjectName) args[1], (ObjectName) args[2], (String[]) args[3],(String[]) args[4]); + } } else { ErrorManager.getDefault().notify( |
From: Greg H. <gh...@us...> - 2004-05-26 02:51:31
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/bean In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20039/src/org/mc4j/console/bean Modified Files: MBeanNode.java Log Message: Fix for bugs #939971, #914838, #957714, #933080 Based on patches submitted by holbitlan. Now removes mbeans from the tree when they are unregistered from the server. This is based on the 10 second, delayed refresh thread. (Not removing beans from dashboard attribute table components on unregister yet as this can cause problems depending on the dashboard match section) Index: MBeanNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/bean/MBeanNode.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** MBeanNode.java 30 Apr 2004 17:20:45 -0000 1.25 --- MBeanNode.java 26 May 2004 02:51:21 -0000 1.26 *************** *** 759,762 **** --- 759,766 ---- return attributesNode; } + + public boolean isRegistered() { + return getMBeanServer().isRegistered(this.objectName); + } } |
From: D.Samsonoff <dsa...@us...> - 2004-05-19 14:47:11
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/proxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22069/src/org/mc4j/console/connection/proxy Modified Files: JMXRemotingMBeanServerProxy.java Log Message: Added support for "removeNotificationListener" operation... Index: JMXRemotingMBeanServerProxy.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/connection/proxy/JMXRemotingMBeanServerProxy.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JMXRemotingMBeanServerProxy.java 21 Mar 2004 21:48:02 -0000 1.2 --- JMXRemotingMBeanServerProxy.java 19 May 2004 14:47:01 -0000 1.3 *************** *** 80,83 **** --- 80,86 ---- this.remoteServer.addNotificationListener((ObjectName) args[0], (NotificationListener) args[1], (NotificationFilter) args[2],(Object) args[3]); return null; + } else if (m.getName().equals("removeNotificationListener")) { + this.remoteServer.removeNotificationListener((ObjectName) args[0], (NotificationListener) args[1]); + return null; } else if (m.getName().equals("setAttribute")) { this.remoteServer.setAttribute((ObjectName) args[0], (Attribute) args[1]); |
From: D.Samsonoff <dsa...@us...> - 2004-05-19 14:44:27
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/bean/notification In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21525/src/org/mc4j/console/bean/notification Modified Files: NotificationNode.java Log Message: Added filter support for notification nodes... Index: NotificationNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/bean/notification/NotificationNode.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** NotificationNode.java 7 Feb 2004 16:10:40 -0000 1.10 --- NotificationNode.java 19 May 2004 14:44:00 -0000 1.11 *************** *** 24,34 **** --- 24,42 ---- import java.util.Arrays; import java.util.Date; + import java.util.Vector; + import javax.management.AttributeChangeNotification; + import javax.management.AttributeChangeNotificationFilter; + import javax.management.InstanceNotFoundException; import javax.management.MBeanNotificationInfo; import javax.management.MBeanServer; + import javax.management.MBeanServerNotification; import javax.management.Notification; + import javax.management.NotificationFilter; import javax.management.NotificationListener; import javax.management.ObjectInstance; import javax.management.ObjectName; + import javax.management.ReflectionException; + import javax.management.relation.MBeanServerNotificationFilter; import org.openide.ErrorManager; *************** *** 106,114 **** try { ! this.server.addNotificationListener( ! this.objectName, ! this.listener, ! null, // don't filter ! null); } catch (Exception e) { ErrorManager.getDefault().notify(e); --- 114,126 ---- try { ! NotificationFilter [] filters = getNotificationFilters(); ! for(int i = 0; i < filters.length; i++) //for every filter available ! { ! this.server.addNotificationListener( ! this.objectName, ! this.listener, ! filters[i], ! null); ! } } catch (Exception e) { ErrorManager.getDefault().notify(e); *************** *** 130,133 **** --- 142,224 ---- } + /** + * Method generates an array of notification filters based on MBeanNotificationInfo. + * + * If a the MBeanNotificationInfo can't be matched to a known/standard filter then an array + * containing a single null-filter element will be returned. + * + * @return array of notification filters + */ + private NotificationFilter[] getNotificationFilters() + { + NotificationFilter [] result = new NotificationFilter[]{null}; + boolean uncrecognisedNotifiationFound = false; + try + { + Vector raw = new Vector(10); + MBeanNotificationInfo [] notifyInfo = (MBeanNotificationInfo[]) server.getMBeanInfo(objectName).getNotifications(); + for(int i = 0; i < notifyInfo.length && !uncrecognisedNotifiationFound; i++) + { + if(notifyInfo[i].getName().equals(getName())) //fetch notification specific to this node... + { + String [] notifyTypes = notifyInfo[i].getNotifTypes(); + + NotificationFilter filter = null; + for(int j = 0; j < notifyTypes.length && !uncrecognisedNotifiationFound; j++) + { + //TODO in the future add more filter support here, if nessesary.... + if(notifyTypes[j].equals(AttributeChangeNotification.ATTRIBUTE_CHANGE)) + { + filter = new AttributeChangeNotificationFilter(); + ((AttributeChangeNotificationFilter) filter).enableAttribute(getName()); + } + else if(notifyTypes[j].equals(MBeanServerNotification.REGISTRATION_NOTIFICATION)) + { + filter = new MBeanServerNotificationFilter(); + ((MBeanServerNotificationFilter) filter).disableAllTypes(); + ((MBeanServerNotificationFilter) filter).enableType(MBeanServerNotification.REGISTRATION_NOTIFICATION); + ((MBeanServerNotificationFilter) filter).enableAllObjectNames(); + } + else if(notifyTypes[j].equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) + { + filter = new MBeanServerNotificationFilter(); + ((MBeanServerNotificationFilter) filter).disableAllTypes(); + ((MBeanServerNotificationFilter) filter).enableType(MBeanServerNotification.UNREGISTRATION_NOTIFICATION); + ((MBeanServerNotificationFilter) filter).enableAllObjectNames(); + } + else //unrecognised notification type, set filter to null.... + { + filter = null; + uncrecognisedNotifiationFound = true; //break the loop... + //once we have a null filter there is no point of + //having any other filters as all of the notifications will have to be + //coming through (in other words we don't know how to filer, so dont' filter at all). + raw.removeAllElements(); + } + raw.add(filter); + } + } + } + if(raw.size() > 0) //do we have anything other than a default result? + { + result = new NotificationFilter[raw.size()]; + result = (NotificationFilter[]) raw.toArray(result); + } + } + catch(ReflectionException e) + { + //DO NOTHING object is not a Notification Broadcaster... + } + catch (javax.management.IntrospectionException e) + { + //DO NOTHING object is not a Notification Broadcaster... + } + catch(InstanceNotFoundException e) + { + ErrorManager.getDefault().notify(e); + } + + return result; + } public static class CustomNotificationListener implements NotificationListener, Serializable { *************** *** 154,157 **** --- 245,249 ---- NotificationTracker.getDefault().addNotification(notification); } + } |
From: D.Samsonoff <dsa...@us...> - 2004-05-12 10:56:50
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/bean/attribute In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29232/src/org/mc4j/console/bean/attribute Modified Files: AttributePropertyFactory.java Log Message: ArrayEditor was moved to a different package.... Index: AttributePropertyFactory.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/bean/attribute/AttributePropertyFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AttributePropertyFactory.java 12 May 2004 10:08:40 -0000 1.4 --- AttributePropertyFactory.java 12 May 2004 10:56:41 -0000 1.5 *************** *** 23,28 **** import org.mc4j.console.bean.MBeanNode; import org.mc4j.console.swing.editor.DateEditor; - import org.mc4j.console.swing.editor.jmx.ArrayEditor; import org.mc4j.console.swing.editor.jmx.ObjectNameEditor; --- 23,28 ---- import org.mc4j.console.bean.MBeanNode; + import org.mc4j.console.swing.editor.ArrayEditor; import org.mc4j.console.swing.editor.DateEditor; import org.mc4j.console.swing.editor.jmx.ObjectNameEditor; |
From: D.Samsonoff <dsa...@us...> - 2004-05-12 10:56:05
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/swing/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29073/src/org/mc4j/console/swing/editor Added Files: ArrayEditor.java Log Message: Allows to display array types in the the property editor... --- NEW FILE: ArrayEditor.java --- package org.mc4j.console.swing.editor; import java.awt.Component; import java.awt.Graphics; import java.awt.Rectangle; import java.beans.PropertyChangeListener; import java.beans.PropertyEditor; import java.lang.reflect.Array; /* * Author: Andrew Couchman & Dima Samsonoff * * The contents of this file are subject to the Sapient Public License Version 1.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy of the * License at http://mc4j.sf.net/License-SPL.html. * * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, * either express or implied. See the License for the specific language governing rights and limitations * under the License. * * The Original Code is The MC4J Management Console * The Initial Developer of the Original Code is Greg Hinkle (gh...@us...) * Copyright (C) 2004 Greg Hinkle. All Rights Reserved. * * Redistributions of code or binary files using or based on this code must reproduce the * above copyright and disclaimer. For more information see <http://mc4j.sourceforge.net>. */ public class ArrayEditor implements PropertyEditor { public final static Class[] SUPPORTED_TYPES = new Class [] { Double[].class, double[].class, Integer[].class, int[].class, Float[].class, float[].class, Long[].class, long[].class, Short[].class, short[].class, Character[].class, char[].class, Boolean[].class, boolean[].class }; private Object value; public void setValue( Object value ) { this.value = value; } public Object getValue() { return value; } public String getAsText() { String result = null; if( value.getClass().isArray() ) { result = getArrayText(); } return result; } private String getArrayText() { StringBuffer result = new StringBuffer(); int length = Array.getLength( value ); for( int i = 0; i < length; i++ ) { result.append( Array.get( value, i) ); if( i != length - 1 ) { result.append( ',' ); } } return result.toString(); } // NOT IMPLEMENTED!! public void setAsText( String text ) throws IllegalArgumentException { throw new IllegalArgumentException( "setAsText not implemented" ); } public String getJavaInitializationString() { // not implemented return null; } public String[] getTags() { // not implemented return null; } public Component getCustomEditor() { // not implemented return null; } public boolean supportsCustomEditor() { return false; } public void addPropertyChangeListener( PropertyChangeListener listener ) { // not implemented } public void removePropertyChangeListener( PropertyChangeListener listener ) { // not implemented } public boolean isPaintable() { return false; } public void paintValue( Graphics gfx, Rectangle box ) { // not implemented } } |
From: D.Samsonoff <dsa...@us...> - 2004-05-12 10:40:00
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/swing/editor/jmx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25962/src/org/mc4j/console/swing/editor/jmx Removed Files: ArrayEditor.java Log Message: --- ArrayEditor.java DELETED --- |
From: D.Samsonoff <dsa...@us...> - 2004-05-12 10:08:52
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/bean/attribute In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19600/src/org/mc4j/console/bean/attribute Modified Files: AttributePropertyFactory.java Log Message: Index: AttributePropertyFactory.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/bean/attribute/AttributePropertyFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AttributePropertyFactory.java 30 Apr 2004 17:20:45 -0000 1.3 --- AttributePropertyFactory.java 12 May 2004 10:08:40 -0000 1.4 *************** *** 24,29 **** --- 24,31 ---- import org.mc4j.console.bean.MBeanNode; import org.mc4j.console.swing.editor.DateEditor; + import org.mc4j.console.swing.editor.jmx.ArrayEditor; import org.mc4j.console.swing.editor.jmx.ObjectNameEditor; + import java.beans.PropertyEditorManager; import java.lang.reflect.InvocationTargetException; *************** *** 39,55 **** public class AttributePropertyFactory { ! private static AttributePropertyFactory factory; private AttributePropertyFactory() { PropertyEditorManager.registerEditor(ObjectName.class, ObjectNameEditor.class); PropertyEditorManager.registerEditor(Date.class, DateEditor.class); ! } public static AttributePropertyFactory getInstance() { ! if (factory == null) { ! factory = new AttributePropertyFactory(); ! } ! return factory; } --- 41,60 ---- public class AttributePropertyFactory { ! private final static AttributePropertyFactory FACTORY = new AttributePropertyFactory(); private AttributePropertyFactory() { PropertyEditorManager.registerEditor(ObjectName.class, ObjectNameEditor.class); PropertyEditorManager.registerEditor(Date.class, DateEditor.class); ! ! //initialize array editors ! for(int i = 0, n = ArrayEditor.SUPPORTED_TYPES.length; i < n; i++ ) ! { ! PropertyEditorManager.registerEditor(ArrayEditor.SUPPORTED_TYPES[i], ArrayEditor.class); ! } ! } public static AttributePropertyFactory getInstance() { ! return FACTORY; } |
From: D.Samsonoff <dsa...@us...> - 2004-05-12 10:02:57
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/swing/editor/jmx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18310/src/org/mc4j/console/swing/editor/jmx Added Files: ArrayEditor.java Log Message: Array display capability for the property editor... --- NEW FILE: ArrayEditor.java --- package org.mc4j.console.swing.editor.jmx; import java.awt.Component; import java.awt.Graphics; import java.awt.Rectangle; import java.beans.PropertyChangeListener; import java.beans.PropertyEditor; import java.lang.reflect.Array; /* * Author: Andrew Couchman & Dima Samsonoff * * The contents of this file are subject to the Sapient Public License Version 1.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy of the * License at http://mc4j.sf.net/License-SPL.html. * * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, * either express or implied. See the License for the specific language governing rights and limitations * under the License. * * The Original Code is The MC4J Management Console * The Initial Developer of the Original Code is Greg Hinkle (gh...@us...) * Copyright (C) 2004 Greg Hinkle. All Rights Reserved. * * Redistributions of code or binary files using or based on this code must reproduce the * above copyright and disclaimer. For more information see <http://mc4j.sourceforge.net>. */ public class ArrayEditor implements PropertyEditor { public final static Class[] SUPPORTED_TYPES = new Class [] { Double[].class, double[].class, Integer[].class, int[].class, Float[].class, float[].class, Long[].class, long[].class, Short[].class, short[].class, Character[].class, char[].class, Boolean[].class, boolean[].class }; private Object value; public void setValue( Object value ) { this.value = value; } public Object getValue() { return value; } public String getAsText() { String result = null; if( value.getClass().isArray() ) { result = getArrayText(); } return result; } private String getArrayText() { StringBuffer result = new StringBuffer(); int length = Array.getLength( value ); for( int i = 0; i < length; i++ ) { result.append( Array.get( value, i) ); if( i != length - 1 ) { result.append( ',' ); } } return result.toString(); } // NOT IMPLEMENTED!! public void setAsText( String text ) throws IllegalArgumentException { throw new IllegalArgumentException( "setAsText not implemented" ); } public String getJavaInitializationString() { // not implemented return null; } public String[] getTags() { // not implemented return null; } public Component getCustomEditor() { // not implemented return null; } public boolean supportsCustomEditor() { return false; } public void addPropertyChangeListener( PropertyChangeListener listener ) { // not implemented } public void removePropertyChangeListener( PropertyChangeListener listener ) { // not implemented } public boolean isPaintable() { return false; } public void paintValue( Graphics gfx, Rectangle box ) { // not implemented } } |
From: Greg H. <gh...@us...> - 2004-05-08 04:05:54
|
Update of /cvsroot/mc4j/mc4j/src/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8427/src/images Modified Files: Thread.gif ThreadBlocked.gif ThreadRunning.gif ThreadTerminated.gif ThreadWaiting.gif Log Message: My latest favorites Index: ThreadWaiting.gif =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/images/ThreadWaiting.gif,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvs1hirKJ and /tmp/cvsIvjrRb differ Index: ThreadRunning.gif =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/images/ThreadRunning.gif,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsSVizHY and /tmp/cvsWRCMWq differ Index: ThreadBlocked.gif =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/images/ThreadBlocked.gif,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsm0Ucrh and /tmp/cvsAnXbUJ differ Index: Thread.gif =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/images/Thread.gif,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsRTvasG and /tmp/cvsRQxhb9 differ Index: ThreadTerminated.gif =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/images/ThreadTerminated.gif,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsZFZ91n and /tmp/cvscf6CiR differ |
From: Greg H. <gh...@us...> - 2004-05-08 04:03:31
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8119/src/org/mc4j/console/dashboard Removed Files: example.xml Log Message: No longer a valid example... real dashboards are available anyway. --- example.xml DELETED --- |
From: Greg H. <gh...@us...> - 2004-05-08 03:55:47
|
Update of /cvsroot/mc4j/mc4j/application/dashboards/jre15 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6758/application/dashboards/jre15 Added Files: JRE15_MemoryUsage_AllPools.xml Log Message: An example of using the ForEach component. Displays graphs for each memory pool in a big long scroll pane. --- NEW FILE: JRE15_MemoryUsage_AllPools.xml --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Dashboard PUBLIC "-//MC4J//DTD Dashboard 1.0//EN" "http://mc4j.sourceforge.net/Dashboard_1_0.dtd"> <Dashboard version="1.0" name="All Memory Pool Graphs"> <Description>Memory usage graph for all JRE 1.5 Memory Pools.</Description> <DashboardMatch type="Global" location="/JVM/Memory"> <BeanMatch id="MemoryPoolList" type="Multiple"> <Condition type="BeanObjectNameCondition" filter="type=MemoryPool"/> </BeanMatch> </DashboardMatch> <LayoutManager type="java.awt.BorderLayout"/> <Content> <!-- *** The header section displays title and a refresh control *** --> <Component type="javax.swing.JPanel"> <Constraint type="BorderConstraints" direction="NORTH"/> <LayoutManager type="java.awt.BorderLayout"/> <Border type="javax.swing.border.EmptyBorder" top="(Literal)2" left="(Literal)5" bottom="(Literal)2" right="(Literal)5"/> <Content> <Component type="javax.swing.JPanel"> <Constraint type="BorderConstraints" direction="CENTER"/> <LayoutManager type="java.awt.BorderLayout"/> <Content> <Component type="javax.swing.JLabel" id="titleLable"> <Constraint type="BorderConstraints" direction="CENTER"/> <Attribute name="text" value="DashboardName"/> <Attribute name="font" value="(Literal)SansSerif bold 20"/> <Attribute name="foreground" value="(Literal)0x666666"/> </Component> <Component type="javax.swing.JTextArea"> <Constraint type="BorderConstraints" direction="SOUTH"/> <Attribute name="text" value="DashboardDescription"/> <Attribute name="font" value="(Literal)DialogInput bold 14"/> <Attribute name="opaque" value="(Literal)false"/> <Attribute name="editable" value="(Literal)false"/> </Component> </Content> </Component> </Content> </Component> <!-- *** Scroll pane of info *** --> <Component type="javax.swing.JScrollPane"> <Attribute name="background" value="(Literal)0xFFFFFF"/> <Content> <Component type="org.mc4j.console.dashboard.components.ForEachPanelComponent"> <Attribute name="BeanList" value="MemoryPoolList"/> <Attribute name="IdKey" value="(Literal)beanNode"/> <Attribute name="background" value="(Literal)0xFFFFFF"/> <Constraint type="BorderConstraints" direction="CENTER"/> <Attribute name="preferredSize" value="100,100"/> <LayoutManager type="java.awt.BoxLayout" axis="Y_AXIS"/> <Content> <Component type="org.mc4j.console.swing.SectionHolder"> <Attribute name="title" value="(Literal)Usage"/> <Attribute name="background" value="(Literal)0xFFFFFF"/> <LayoutManager type="java.awt.GridLayout" rows="1" cols="1"/> <Content> <Component type="org.mc4j.jre15.components.MemoryUsageComponent"> <Attribute name="beanNode" value="beanNode"/> <Attribute name="preferredSize" value="(Literal)400,250"/> <Attribute name="attributeName" value="(Literal)Usage"/> </Component> </Content> </Component> <Component type="org.mc4j.console.swing.SectionHolder"> <Attribute name="title" value="(Literal)Peak Usage"/> <Attribute name="background" value="(Literal)0xFFFFFF"/> <LayoutManager type="java.awt.GridLayout" rows="1" cols="1"/> <Content> <Component type="org.mc4j.jre15.components.MemoryUsageComponent"> <Attribute name="beanNode" value="beanNode"/> <Attribute name="preferredSize" value="(Literal)400,250"/> <Attribute name="attributeName" value="(Literal)PeakUsage"/> </Component> </Content> </Component> <Component type="org.mc4j.console.dashboard.components.FillerComponent"> <Attribute name="type" value="(Literal)VERTICAL_GLUE_SHAPE"/> </Component> </Content> </Component> </Content> </Component> </Content> </Dashboard> |
From: Greg H. <gh...@us...> - 2004-05-08 03:53:10
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6349/src/org/mc4j/console/dashboard Modified Files: DashboardFactory.java Log Message: Support for a ForEach component that allows for iterating over a list to create repeating ui components. Index: DashboardFactory.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/DashboardFactory.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** DashboardFactory.java 8 Apr 2004 20:30:43 -0000 1.11 --- DashboardFactory.java 8 May 2004 03:53:00 -0000 1.12 *************** *** 20,23 **** --- 20,33 ---- package org.mc4j.console.dashboard; + import org.w3c.dom.Document; + import org.w3c.dom.Element; + import org.w3c.dom.Node; + import org.w3c.dom.NodeList; + import org.xml.sax.SAXException; + + import org.mc4j.console.bean.MBeanNode; + import org.mc4j.console.dashboard.components.ForEachPanelComponent; + import org.mc4j.console.util.ExceptionUtility; + import java.awt.Color; import java.awt.Dimension; *************** *** 29,32 **** --- 39,43 ---- import java.io.IOException; import java.io.InputStream; + import java.util.List; import java.util.Map; *************** *** 39,50 **** import javax.xml.parsers.ParserConfigurationException; - import org.mc4j.console.util.ExceptionUtility; - - import org.w3c.dom.Document; - import org.w3c.dom.Element; - import org.w3c.dom.Node; - import org.w3c.dom.NodeList; - import org.xml.sax.SAXException; - /** * --- 50,53 ---- *************** *** 126,129 **** --- 129,144 ---- + /** + * Works against the root <i>Dashboard</i> element to layout the base of the + * dashboard. This involves setting up the root pane's layout manager, setting + * up description and context elements, and then calling for the buildout of the + * root <i>Content</i> element. + * + * @param dashboard + * @param context + * @return + * @throws SAXException + * @throws IOException + */ public JComponent buildDashboard(Dashboard dashboard, Map context) throws SAXException, IOException { *************** *** 175,180 **** return contentPanel; } ! ! private void buildV1Content(Element element, Map context) { --- 190,201 ---- return contentPanel; } ! ! ! /** ! * Builds out a <i>Content</i> element either contained in the root <i>Dashboard</i> ! * element, or contained within an included <i>Component</i> element. ! * @param element ! * @param context ! */ private void buildV1Content(Element element, Map context) { *************** *** 210,214 **** } } ! public JComponent buildV1Component(Element node, Map context) { JComponent parent = (JComponent) context.get("parent"); --- 231,242 ---- } } ! ! /** ! * Builds out a <i>Component</i> element. ! * ! * @param node ! * @param context ! * @return ! */ public JComponent buildV1Component(Element node, Map context) { JComponent parent = (JComponent) context.get("parent"); *************** *** 219,223 **** ! Element layoutManagerElement = findChild(node, "LayoutManager"); if (layoutManagerElement != null) { --- 247,251 ---- ! // Setup the layout manager for any sub-content Element layoutManagerElement = findChild(node, "LayoutManager"); if (layoutManagerElement != null) { *************** *** 233,240 **** if (contentsElement != null) { context.put("parent", component); ! buildV1Content(contentsElement, context); } context.put("parent", parent); ! Element borderElement = findChild(node, "Border"); if (borderElement != null) { --- 261,273 ---- if (contentsElement != null) { context.put("parent", component); ! if (component instanceof ForEachPanelComponent) { ! buildV1ForEachContent(contentsElement, context, (ForEachPanelComponent) component); ! } else { ! buildV1Content(contentsElement, context); ! } } context.put("parent", parent); ! ! // Setup the border for this component Element borderElement = findChild(node, "Border"); if (borderElement != null) { *************** *** 253,260 **** return component; } - ! ! private void loadContexts(Element parent, Map context) { NodeList children = parent.getChildNodes(); --- 286,314 ---- return component; } ! ! public void buildV1ForEachContent(Element element, Map context, ForEachPanelComponent forEachPanelComponent) { ! ! Integer baseIndex = (Integer) context.get("index"); ! ! List beanList = forEachPanelComponent.getBeanList(); ! for (int i = 0; i < beanList.size(); i++) { ! MBeanNode mBeanNode = (MBeanNode) beanList.get(i); ! context.put("index", new Integer(i)); ! ! context.put(forEachPanelComponent.getIdKey(), mBeanNode); ! ! buildV1Content(element, context); ! } ! ! ! if (baseIndex != null) { ! context.put("index", baseIndex); ! } else { ! context.remove("index"); ! } ! } ! ! private void loadContexts(Element parent, Map context) { NodeList children = parent.getChildNodes(); |
From: Greg H. <gh...@us...> - 2004-05-08 03:53:09
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/dashboard/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6349/src/org/mc4j/console/dashboard/components Added Files: ForEachPanelComponent.java Log Message: Support for a ForEach component that allows for iterating over a list to create repeating ui components. --- NEW FILE: ForEachPanelComponent.java --- /* * Author: Greg Hinkle * * The contents of this file are subject to the Sapient Public License Version 1.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy of the * License at http://mc4j.sf.net/License-SPL.html. * * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, * either express or implied. See the License for the specific language governing rights and limitations * under the License. * * The Original Code is The MC4J Management Console * The Initial Developer of the Original Code is Greg Hinkle (gh...@us...) * Copyright (C) 2004 Greg Hinkle. All Rights Reserved. * * Redistributions of code or binary files using or based on this code must reproduce the * above copyright and disclaimer. For more information see <http://mc4j.sourceforge.net>. */ package org.mc4j.console.dashboard.components; import java.util.List; import java.util.Map; import javax.swing.JPanel; /** * Supports a for-each iteration of a set of beans * * @author Greg Hinkle (gh...@us...), January 2004 * @version $Revision: 1.1 $($Author: ghinkl $ / $Date: 2004/05/08 03:53:00 $) */ public class ForEachPanelComponent extends JPanel implements BeanListComponent { protected List mbeanNodes; protected String idKey; protected boolean sorted = false; public void init() { } public void refresh() { } public String getIdKey() { return idKey; } public void setIdKey(String idKey) { this.idKey = idKey; } public void setBeanList(List list) { this.mbeanNodes = list; } public List getBeanList() { return mbeanNodes; } public void setContext(Map context) { if (this.mbeanNodes == null) { throw new IllegalStateException( "AttributeTableComponent: You must specify an appropriate [beanList] attribute."); } init(); } } |
From: Greg H. <gh...@us...> - 2004-04-30 17:25:08
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28260/src/org/mc4j/console/install Modified Files: ExplorerUtil.java Log Message: Now activating the panel so that the property view gets updated with the latest selected nodes. (Useful for the click to browse to of the ObjectNameEditor) Index: ExplorerUtil.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/install/ExplorerUtil.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ExplorerUtil.java 31 Mar 2004 03:16:04 -0000 1.9 --- ExplorerUtil.java 30 Apr 2004 17:24:56 -0000 1.10 *************** *** 20,25 **** package org.mc4j.console.install; - import java.beans.PropertyVetoException; - import org.openide.ErrorManager; import org.openide.nodes.Node; --- 20,23 ---- *************** *** 27,30 **** --- 25,30 ---- import org.mc4j.console.ConnectionExplorer; + import java.beans.PropertyVetoException; + /** * Useful utilities for dealing with the primary connection explorer tree. *************** *** 49,53 **** ExplorerUtil.getExplorer().getBeanTreeView().expandNode(node); try { ! ExplorerUtil.getExplorer().getExplorerManager().setSelectedNodes(new Node[] { node }); } catch (PropertyVetoException pve) { ErrorManager.getDefault().notify(pve); --- 49,54 ---- ExplorerUtil.getExplorer().getBeanTreeView().expandNode(node); try { ! ExplorerUtil.getExplorer().getExplorerManager().setSelectedNodes(new Node[] { node }); ! ExplorerUtil.getExplorer().requestActive(); } catch (PropertyVetoException pve) { ErrorManager.getDefault().notify(pve); |
From: Greg H. <gh...@us...> - 2004-04-30 17:23:55
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/jre15/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28033/src/org/mc4j/jre15/components Modified Files: MemoryUsageLineChartComponent.java Log Message: Shouldn't have overridden getTimeDelay Index: MemoryUsageLineChartComponent.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/jre15/components/MemoryUsageLineChartComponent.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MemoryUsageLineChartComponent.java 9 Apr 2004 01:54:16 -0000 1.2 --- MemoryUsageLineChartComponent.java 30 Apr 2004 17:23:46 -0000 1.3 *************** *** 20,23 **** --- 20,31 ---- package org.mc4j.jre15.components; + import org.jfree.data.DefaultPieDataset; + import org.jfree.data.time.Millisecond; + import org.jfree.data.time.TimeSeries; + + import org.mc4j.console.bean.MBeanNode; + import org.mc4j.console.dashboard.Dashboard; + import org.mc4j.console.dashboard.components.NumericAttributeGraph; + import java.lang.management.MemoryUsage; import java.util.Iterator; *************** *** 28,39 **** import javax.management.ObjectName; - import org.mc4j.console.bean.MBeanNode; - import org.mc4j.console.dashboard.Dashboard; - import org.mc4j.console.dashboard.components.NumericAttributeGraph; - - import org.jfree.data.DefaultPieDataset; - import org.jfree.data.time.Millisecond; - import org.jfree.data.time.TimeSeries; - /** * You use this like an Attribute Graph Panel and it shows a --- 36,39 ---- *************** *** 75,81 **** } ! public long getUpdateDelay() { ! return 1000; ! } public void setContext(Map context) { --- 75,79 ---- } ! public void setContext(Map context) { |
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/swing/editor/calendar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27916/src/org/mc4j/console/swing/editor/calendar Removed Files: CalendarDateEditor.java CalendarDaysTable.java CalendarModel.java CalendarPanel.java DefaultCalendarModel.java Log Message: Going to a new calendar editor that is a lot simpler --- CalendarPanel.java DELETED --- --- CalendarDaysTable.java DELETED --- --- CalendarDateEditor.java DELETED --- --- DefaultCalendarModel.java DELETED --- --- CalendarModel.java DELETED --- |
From: Greg H. <gh...@us...> - 2004-04-30 17:21:26
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/bean/attribute In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27418/src/org/mc4j/console/bean/attribute Modified Files: AttributeNode.java AttributePropertyFactory.java AttributeSetNode.java Log Message: Better error handling for attribute retrieval displaying null versus cannot display for transfer/serialization erros refactored the inplace editors as per the newer inplace editor model Index: AttributeNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/bean/attribute/AttributeNode.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** AttributeNode.java 21 Apr 2004 20:41:17 -0000 1.11 --- AttributeNode.java 30 Apr 2004 17:20:45 -0000 1.12 *************** *** 58,61 **** --- 58,63 ---- protected Object currentValue; + protected boolean canDisplay = true; + /** * @deprecated *************** *** 94,97 **** --- 96,107 ---- } + public boolean isCanDisplay() { + return canDisplay; + } + + public void setCanDisplay(boolean canDisplay) { + this.canDisplay = canDisplay; + } + public void updateValue(Object newValue) { Object oldValue = this.currentValue; *************** *** 124,128 **** } catch (Exception e) { //e.printStackTrace(); ! newValue = "unknown type"; } --- 134,140 ---- } catch (Exception e) { //e.printStackTrace(); ! //newValue = "unknown type"; ! setCanDisplay(false); ! setShortDescription("Type is unkown and can't be displayed"); } *************** *** 302,427 **** - /* - private Node.Property buildAttributeValuePropertyOld() { - Node.Property property = null; - - - PropertyEditorManager.registerEditor( - ObjectName.class, - ObjectNameEditor.class); - - try { - MBeanNode.findType(attributeInfo.getType()); - - if (true) { //attributeInfo.isReadable() && attributeInfo.isWritable()) { - property = - new PropertySupport.ReadWrite( - "value", - MBeanNode.findType(attributeInfo.getType()), - "Value", - attributeInfo.getDescription()) { - - public void setValue(Object value) - throws IllegalAccessException, - InvocationTargetException { - try { - server.setAttribute(objectName, - new Attribute(attributeInfo.getName(), value)); - } catch (Exception e) { - throw new InvocationTargetException(e); - } - } - - public Object getValue(String attributeName) { - if ("inplaceEditor".equals(attributeName)) { - return new DateEditor(); - } else { - return super.getValue(attributeName); - } - } - public Object getValue() - throws IllegalAccessException, - InvocationTargetException { - try { - //if (getValueType().equals(Date.class)) - // return new DateEditor(); - return server.getAttribute(objectName, attributeInfo.getName()); - } catch (Exception e) { - return null; - //throw new InvocationTargetException(e); - } - } - - public PropertyEditor getPropertyEditor() { - - return new PropertyEditorSupport() { - public String getAsText() { - return "hello"; - } - - }; - - } - - }; - } else { - property = - new PropertySupport.ReadOnly ( - "value", - MBeanNode.findType(attributeInfo.getType()), - "Value", - attributeInfo.getDescription()) { - public Object getValue(String attributeName) { - if ("inplaceEditor".equals(attributeName)) { - return new DateEditor(); - } else { - return super.getValue(attributeName); - } - } - - public Object getValue() - throws IllegalAccessException, - InvocationTargetException { - try { - - return server.getAttribute(objectName, attributeInfo.getName()); - } catch (Exception e) { - return null; - //throw new InvocationTargetException(e); - } - } - public PropertyEditor getPropertyEditor() { - return new ExPropertyEditorSupport() { - protected void attachEnvImpl(PropertyEnv env) { - env.registerInplaceEditorFactory(new InplaceEditor.Factory() { - public InplaceEditor getInplaceEditor() { - return new DateEditor(); - } - }); - } - - protected void validateEnv(PropertyEnv env) { - env.registerInplaceEditorFactory(new InplaceEditor.Factory() { - public InplaceEditor getInplaceEditor() { - return new DateEditor(); - } - }); - } - - public String getAsText() { - return "Bah"; - } - }; - } - }; - } - } catch (Exception e) { - //TopManager.getDefault().getErrorManager().notify(e); - } - return property; - } - */ - - public static class AttributeNodeStringProperty extends Node.Property { --- 314,317 ---- Index: AttributePropertyFactory.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/bean/attribute/AttributePropertyFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AttributePropertyFactory.java 7 Apr 2004 03:08:09 -0000 1.2 --- AttributePropertyFactory.java 30 Apr 2004 17:20:45 -0000 1.3 *************** *** 19,29 **** package org.mc4j.console.bean.attribute; - import java.lang.reflect.InvocationTargetException; - - import javax.management.MBeanAttributeInfo; import org.openide.nodes.Node; import org.mc4j.console.bean.MBeanNode; /** --- 19,35 ---- package org.mc4j.console.bean.attribute; import org.openide.nodes.Node; import org.mc4j.console.bean.MBeanNode; + import org.mc4j.console.swing.editor.DateEditor; + import org.mc4j.console.swing.editor.jmx.ObjectNameEditor; + + import java.beans.PropertyEditorManager; + import java.lang.reflect.InvocationTargetException; + import java.util.Date; + + import javax.management.MBeanAttributeInfo; + import javax.management.ObjectName; /** *************** *** 35,38 **** --- 41,50 ---- private static AttributePropertyFactory factory; + private AttributePropertyFactory() { + PropertyEditorManager.registerEditor(ObjectName.class, ObjectNameEditor.class); + PropertyEditorManager.registerEditor(Date.class, DateEditor.class); + + } + public static AttributePropertyFactory getInstance() { if (factory == null) { *************** *** 48,62 **** Node.Property property = null; ! try { ! ! Class type = MBeanNode.findType(attributeInfo.getType()); ! ! property = new AttributeProperty(type, node); ! } catch (ClassNotFoundException cnfe) { ! //ErrorManager.getDefault().notify(cnfe); property = new AttributeProperty(node); - } --- 60,75 ---- Node.Property property = null; ! if (node.isCanDisplay()) { ! try { ! Class type = MBeanNode.findType(attributeInfo.getType()); + property = new AttributeProperty(type, node); + } catch (ClassNotFoundException cnfe) { + //ErrorManager.getDefault().notify(cnfe); + property = new AttributeProperty(node); + } + } else { property = new AttributeProperty(node); } *************** *** 77,80 **** --- 90,95 ---- setName(this.attributeNode.getDisplayName()); + setShortDescription(attributeNode.getAttributeInfo().getDescription() + + " (" + attributeNode.getAttributeInfo().getType() + ")"); } *************** *** 106,110 **** public Object getValue() throws IllegalAccessException, InvocationTargetException { ! return this.attributeNode.getValue(); } --- 121,129 ---- public Object getValue() throws IllegalAccessException, InvocationTargetException { ! if (this.attributeNode.isCanDisplay()) { ! return this.attributeNode.getValue(); ! } else { ! return "<cannot display>"; ! } } Index: AttributeSetNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/bean/attribute/AttributeSetNode.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AttributeSetNode.java 2 Apr 2004 03:27:55 -0000 1.9 --- AttributeSetNode.java 30 Apr 2004 17:20:45 -0000 1.10 *************** *** 20,33 **** package org.mc4j.console.bean.attribute; - import java.util.ArrayList; - import java.util.HashMap; - import java.util.Iterator; - import java.util.List; - import java.util.Map; - - import javax.management.Attribute; - import javax.management.AttributeList; - import javax.management.MBeanAttributeInfo; - import org.openide.nodes.AbstractNode; import org.openide.nodes.Node; --- 20,23 ---- *************** *** 41,44 **** --- 31,44 ---- import org.mc4j.console.install.ExplorerUtil; + import java.util.ArrayList; + import java.util.HashMap; + import java.util.Iterator; + import java.util.List; + import java.util.Map; + + import javax.management.Attribute; + import javax.management.AttributeList; + import javax.management.MBeanAttributeInfo; + /** * The MBeanNode child that holds the attributes. *************** *** 117,121 **** node.updateValue(value); } else { ! node.updateValue("unknown type"); } } --- 117,126 ---- node.updateValue(value); } else { ! if (values.containsKey(node.getName())) { ! node.updateValue(null); ! } else { ! node.setCanDisplay(false); ! node.setShortDescription("Value could not be displayed"); ! } } } |
From: Greg H. <gh...@us...> - 2004-04-30 17:21:26
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/bean In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27418/src/org/mc4j/console/bean Modified Files: MBeanNode.java Log Message: Better error handling for attribute retrieval displaying null versus cannot display for transfer/serialization erros refactored the inplace editors as per the newer inplace editor model Index: MBeanNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/bean/MBeanNode.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** MBeanNode.java 7 Apr 2004 15:27:34 -0000 1.24 --- MBeanNode.java 30 Apr 2004 17:20:45 -0000 1.25 *************** *** 20,23 **** --- 20,47 ---- package org.mc4j.console.bean; + import org.openide.ErrorManager; + import org.openide.actions.PropertiesAction; + import org.openide.nodes.AbstractNode; + import org.openide.nodes.Node; + import org.openide.nodes.PropertySupport; + import org.openide.nodes.Sheet; + import org.openide.util.HelpCtx; + import org.openide.util.actions.NodeAction; + import org.openide.util.actions.SystemAction; + import org.openide.windows.IOProvider; + + import org.mc4j.console.Refreshable; + import org.mc4j.console.bean.attribute.AttributeNameComparator; + import org.mc4j.console.bean.attribute.AttributeNode; + import org.mc4j.console.bean.attribute.AttributeSetNode; + import org.mc4j.console.bean.notification.NotificationNameComparator; + import org.mc4j.console.bean.notification.NotificationNode; + import org.mc4j.console.bean.notification.NotificationSetNode; + import org.mc4j.console.bean.operation.OperationNameComparator; + import org.mc4j.console.bean.operation.OperationNode; + import org.mc4j.console.bean.operation.OperationSetNode; + import org.mc4j.console.connection.ConnectionNode; + import org.mc4j.console.install.ExplorerUtil; + import java.awt.Component; import java.awt.event.ActionEvent; *************** *** 33,37 **** import java.net.URLDecoder; import java.util.ArrayList; - import java.util.Date; import java.util.HashMap; import java.util.HashSet; --- 57,60 ---- *************** *** 56,85 **** import javax.swing.JButton; - import org.openide.ErrorManager; - import org.openide.actions.PropertiesAction; - import org.openide.nodes.AbstractNode; - import org.openide.nodes.Node; - import org.openide.nodes.PropertySupport; - import org.openide.nodes.Sheet; - import org.openide.util.HelpCtx; - import org.openide.util.actions.NodeAction; - import org.openide.util.actions.SystemAction; - import org.openide.windows.IOProvider; - - import org.mc4j.console.Refreshable; - import org.mc4j.console.bean.attribute.AttributeNameComparator; - import org.mc4j.console.bean.attribute.AttributeNode; - import org.mc4j.console.bean.attribute.AttributeSetNode; - import org.mc4j.console.bean.notification.NotificationNameComparator; - import org.mc4j.console.bean.notification.NotificationNode; - import org.mc4j.console.bean.notification.NotificationSetNode; - import org.mc4j.console.bean.operation.OperationNameComparator; - import org.mc4j.console.bean.operation.OperationNode; - import org.mc4j.console.bean.operation.OperationSetNode; - import org.mc4j.console.connection.ConnectionNode; - import org.mc4j.console.install.ExplorerUtil; - import org.mc4j.console.swing.editor.ObjectNameEditor; - import org.mc4j.console.swing.editor.calendar.CalendarDateEditor; - /** --- 79,82 ---- *************** *** 407,417 **** protected void registerEditors() { - PropertyEditorManager.registerEditor( - Date.class, - CalendarDateEditor.class); - PropertyEditorManager.registerEditor( - ObjectName.class, - ObjectNameEditor.class); } --- 404,408 ---- |
From: Greg H. <gh...@us...> - 2004-04-30 17:21:12
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/swing/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27418/src/org/mc4j/console/swing/editor Modified Files: CalendarComboBox.java DateEditor.java Removed Files: DateEditor.form ObjectNameEditor.java ObjectNameSelector.java Log Message: Better error handling for attribute retrieval displaying null versus cannot display for transfer/serialization erros refactored the inplace editors as per the newer inplace editor model --- ObjectNameSelector.java DELETED --- Index: CalendarComboBox.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/swing/editor/CalendarComboBox.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CalendarComboBox.java 31 Mar 2004 03:29:03 -0000 1.1 --- CalendarComboBox.java 30 Apr 2004 17:20:45 -0000 1.2 *************** *** 500,504 **** public static void main(String[] args) { JFrame frame = new JFrame("Calendar combo box test"); ! frame.getContentPane().add(new CalendarComboBox()); frame.setVisible(true); --- 500,504 ---- public static void main(String[] args) { JFrame frame = new JFrame("Calendar combo box test"); ! frame.getContentPane().add(new CalendarComboBox(true)); frame.setVisible(true); Index: DateEditor.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/swing/editor/DateEditor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DateEditor.java 31 Mar 2004 03:29:03 -0000 1.5 --- DateEditor.java 30 Apr 2004 17:21:03 -0000 1.6 *************** *** 20,42 **** package org.mc4j.console.swing.editor; import java.awt.Component; import java.awt.Graphics; ! import java.awt.Insets; ! import java.awt.Point; import java.awt.event.ActionListener; - import java.awt.event.FocusEvent; - import java.awt.event.FocusListener; - import java.awt.event.InputEvent; - import java.awt.event.KeyEvent; import java.beans.PropertyEditor; import java.util.Date; import javax.swing.JComponent; import javax.swing.KeyStroke; - import javax.swing.SwingUtilities; - - import org.openide.explorer.propertysheet.InplaceEditor; - import org.openide.explorer.propertysheet.PropertyEnv; - import org.openide.explorer.propertysheet.PropertyModel; /** --- 20,38 ---- package org.mc4j.console.swing.editor; + import org.openide.explorer.propertysheet.ExPropertyEditor; + import org.openide.explorer.propertysheet.InplaceEditor; + import org.openide.explorer.propertysheet.PropertyEnv; + import org.openide.explorer.propertysheet.PropertyModel; + import java.awt.Component; import java.awt.Graphics; ! import java.awt.Rectangle; import java.awt.event.ActionListener; import java.beans.PropertyEditor; + import java.beans.PropertyEditorSupport; import java.util.Date; import javax.swing.JComponent; import javax.swing.KeyStroke; /** *************** *** 45,49 **** * @version $Revision$($Author$ / $Date$) */ ! public class DateEditor extends CalendarComboBox implements InplaceEditor { private Date currentDate; --- 41,45 ---- * @version $Revision$($Author$ / $Date$) */ ! public class DateEditor extends PropertyEditorSupport implements ExPropertyEditor, InplaceEditor.Factory { private Date currentDate; *************** *** 53,542 **** protected PropertyEditor editor; protected PropertyEnv env; ! protected PropertyModel mdl; ! boolean inSetUI=false; ! private boolean tableUI; ! private boolean connecting=false; ! private boolean hasBeenEditable=false; ! private boolean needLayout=false; ! ! /*Keystrokes this inplace editor wants to consume */ ! static final KeyStroke[] cbKeyStrokes = ! new KeyStroke[] {KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,0,false), ! KeyStroke.getKeyStroke(KeyEvent.VK_UP,0,false), ! KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,0,true), ! KeyStroke.getKeyStroke(KeyEvent.VK_UP,0,true), ! KeyStroke.getKeyStroke (KeyEvent.VK_PAGE_DOWN,0,false), ! KeyStroke.getKeyStroke (KeyEvent.VK_PAGE_UP,0,false), ! KeyStroke.getKeyStroke (KeyEvent.VK_PAGE_DOWN,0,true), ! KeyStroke.getKeyStroke (KeyEvent.VK_PAGE_UP,0,true) ! }; ! ! /** Create a ComboInplaceEditor - the tableUI flag will tell it to use ! * less borders & such */ ! public DateEditor() { ! super(true); ! } ! ! public void addActionListener(ActionListener al) { ! //To change body of implemented methods use File | Settings | File Templates. ! } ! ! public void removeActionListener(ActionListener al) { ! //To change body of implemented methods use File | Settings | File Templates. ! } ! ! /** Overridden to add a listener to the editor if necessary, since the ! * UI won't do that for us without a focus listener */ ! public void addNotify() { ! super.addNotify(); ! ! // TODO GH: Probably important ! //getEditor().getEditorComponent().addFocusListener(this); ! ! getLayout().layoutContainer(this); ! } ! ! ! ! /** Overridden to hide the popup and remove any listeners from the ! * combo editor */ ! public void removeNotify() { ! log ("Combo editor for " + editor + " removeNotify forcing popup close"); ! setVisible(false); ! super.removeNotify(); ! //getEditor().getEditorComponent().removeFocusListener(this); ! } - public Insets getInsets() { - return new Insets(0,0,0,0); - } ! public Point getLocation(Point rv) { ! return new Point(0,0); } ! public void clear() { ! editor = null; ! env = null; } ! public void connect(PropertyEditor pe, PropertyEnv env) { ! connecting = true; ! try { ! log ("Combo editor connect to " + pe + " env=" + env); ! ! this.env = env; ! this.editor = pe; ! //setModel(new DefaultComboBoxModel(pe.getTags())); ! /* ! boolean editable = (editor instanceof EnhancedPropertyEditor) ? ! ((EnhancedPropertyEditor) editor).supportsEditingTaggedValues() : ! env != null && ! Boolean.TRUE.equals( ! env.getFeatureDescriptor().getValue("canEditAsText")); //NOI18N ! */ ! //setEditable (editable); ! //setActionCommand(COMMAND_SUCCESS); ! reset(); ! ! } finally { ! connecting = false; } - } ! private void log (String s) { ! //if (PropUtils.isLoggable(ComboInplaceEditor.class) && getClass() == ComboInplaceEditor.class) { ! // PropUtils.log (ComboInplaceEditor.class, s); //NOI18N ! //} ! } ! ! public void setSelectedItem(Object o) { ! //Some property editors (i.e. IMT's choice editor) treat ! //null as 0. Probably not the right way to do it, but needs to ! //be handled. ! if (o == null) { ! o = editor.getTags()[0]; ! } ! //super.setSelectedItem(o); } ! ! /** Overridden to not fire changes is an event is called inside the ! * connect method */ ! public void fireActionEvent() { ! if (connecting || editor == null) { ! return; ! } else { ! /* ! if ("comboBoxEdited".equals(getActionCommand())) { ! log ("Translating comboBoxEdited action command to COMMAND_SUCCESS"); ! setActionCommand(COMMAND_SUCCESS); ! } ! log ("Combo editor firing ActionPerformed command=" + getActionCommand()); ! super.fireActionEvent(); ! */ ! } } - public void reset() { - log ("Combo editor reset setting selected item to " + editor.getAsText()); - String targetValue = editor.getAsText(); ! //issue 26367, form editor needs ability to set a custom value ! //when editing is initiated (event handler combos, part of them ! //cleaning up their EnhancedPropertyEditors). ! /* if (getClass() == ComboInplaceEditor.class && env != null && ! env.getFeatureDescriptor() != null) { ! ! String initialEditValue = (String) env.getFeatureDescriptor(). ! getValue("initialEditValue"); //NOI18N ! ! if (initialEditValue != null) { ! targetValue = initialEditValue; ! } ! ! } ! */ ! setSelectedItem(targetValue); } public Object getValue() { ! /* ! if (isEditable()) { ! return getEditor().getItem(); ! } else { ! return getSelectedItem(); ! } ! */ ! ! return super.getDate(); ! } ! ! public PropertyEditor getPropertyEditor() { ! return editor; ! } ! ! public PropertyModel getPropertyModel() { ! return mdl; ! } ! ! public void setPropertyModel(PropertyModel pm) { ! log ("Combo editor set property model to " + pm); ! this.mdl=pm; ! } ! ! public JComponent getComponent() { ! return this; ! } ! ! public KeyStroke[] getKeyStrokes() { ! return cbKeyStrokes; } - public void handleInitialInputEvent(InputEvent e) { - //do nothing, this should get deprecated in InplaceEditor - } - /** Overridden to set a flag used to block the UI from adding a focus - * listener, and to use an alternate renderer class on GTK look and feel - * to work around a painting bug in SynthComboUI (colors not set correctly)*/ - /* - public void setUI(ComboBoxUI ui) { - inSetUI=true; - try { - super.setUI(ui); - } finally { - inSetUI=false; - } - //Workaround for GTK look and feel - combo boxes ignore background - //color in 1.4.2 - //XXX update this code if fixed in JDK 1.5 - if ( - ui.getClass().getName().equals( - "com.sun.java.swing.plaf.gtk.SynthComboBoxUI")) { //NOI18N - setRenderer (new Renderer()); } - } - */ - /** Overridden to handle a corner case - an NPE if the UI tries to display - * the popup, but the combo box is removed from the parent before that can - * happen - only happens on very rapid clicks between popups */ - /* - public void showPopup() { ! try { ! log (" Combo editor show popup"); ! super.showPopup(); ! } catch (NullPointerException e) { ! //An inevitable consequence - the look and feel will queue display ! //of the popup, but it can be processed after the combo box is ! //offscreen ! log (" Combo editor show popup later due to npe"); ! ! SwingUtilities.invokeLater(new Runnable() { ! public void run() { ! ComboInplaceEditor.super.showPopup(); ! } ! }); } - } - */ ! /* ! private void prepareEditor() { ! Component c = getEditor().getEditorComponent(); ! if (c instanceof JTextComponent) { ! JTextComponent jtc = (JTextComponent) c; ! String s = jtc.getText(); ! if (s != null && s.length() > 0){ ! jtc.setSelectionStart(0); ! jtc.setSelectionEnd(s.length()); ! } ! if (tableUI) { ! jtc.setBackground(getBackground()); ! } else { ! jtc.setBackground(PropUtils.getTextFieldBackground()); ! } ! } ! if (getLayout() != null) { ! getLayout().layoutContainer(this); } - c.requestFocus(); - repaint(); - }*/ ! /** Overridden to do the focus-popup handling that would normally be done ! * by the look and feel */ ! /* ! public void processFocusEvent(FocusEvent fe) { ! super.processFocusEvent(fe); ! Component focusOwner = KeyboardFocusManager. ! getCurrentKeyboardFocusManager().getFocusOwner(); ! ! if (isDisplayable() && fe.getID()==fe.FOCUS_GAINED && focusOwner==this ! && !isPopupVisible()) { ! if (isEditable()) { ! prepareEditor(); ! // showPopup(); ! } else { ! if (tableUI) { ! showPopup(); ! //Try to beat the event mis-ordering at its own game ! SwingUtilities.invokeLater(new PopupChecker()); ! } ! } ! repaint(); ! } else if (fe.getID() == fe.FOCUS_LOST && isPopupVisible() && !isDisplayable()) { ! if (!PropUtils.psCommitOnFocusLoss) { ! setActionCommand(COMMAND_FAILURE); ! fireActionEvent(); ! } ! //We were removed, but we may be immediately added. See if that's the ! //case after other queued events run ! SwingUtilities.invokeLater(new Runnable() { ! public void run() { ! if (!isDisplayable()) { ! hidePopup(); ! } ! } ! }); } - repaint(); - } - */ - - public boolean isKnownComponent(Component c) { - return (c == super.calPanel); - } - - public void setValue(Object o) { - super.setDate((Date) o); - } - - /** Returns true if the combo box is editable */ - public boolean supportsTextEntry() { - return true; - } ! /** Overridden to install an ancestor listener which will ensure the ! * popup is always opened correctly */ ! protected void installAncestorListener() { ! //Use a replacement which will check to ensure the popup is ! //displayed ! ! //addAncestorListener(this); ! ! } ! ! /** Overridden to block the UI from adding its own focus listener, which ! * will close the popup at the wrong times. We will manage focus ! * ourselves instead */ ! public void addFocusListener(FocusListener fl) { ! if (!inSetUI || !tableUI) { ! super.addFocusListener(fl); } - } - - public void focusGained(FocusEvent e) { - //do nothing - } ! /** If the editor loses focus, we're done editing - fire COMMAND_FAILURE */ ! public void focusLost(FocusEvent e) { ! /* ! Component c = e.getOppositeComponent(); ! if (!isAncestorOf(c) && c != getEditor().getEditorComponent()) { ! if (c == this || (c instanceof SheetTable && ! ((SheetTable)c).isAncestorOf(this))) { ! //workaround for issue 38029 - editable combo editor can lose focus to ...itself ! return; ! } ! setActionCommand(COMMAND_FAILURE); ! log (" Combo editor lost focus - setting action command to " + COMMAND_FAILURE); ! getEditor().getEditorComponent().removeFocusListener(this); ! if (checker == null) { ! log ("No active popup checker, firing action event"); ! fireActionEvent(); ! } } - */ - } ! /** Overridden to ensure the editor gets focus if editable */ ! public void firePopupMenuCanceled() { ! /* ! super.firePopupMenuCanceled(); ! if (isEditable()) { ! Component focus = KeyboardFocusManager. ! getCurrentKeyboardFocusManager().getFocusOwner(); ! if (isDisplayable() && focus == this) { ! log ("combo editor popup menu canceled. Requesting focus on editor component"); ! getEditor().getEditorComponent().requestFocus(); ! } } - */ - } ! /** Overridden to fire COMMAND_FAILURE on Escape */ ! public void processKeyEvent(KeyEvent ke) { ! /* ! super.processKeyEvent(ke); ! if (ke.getID() == ke.KEY_PRESSED && ke.getKeyCode() == ke.VK_ESCAPE) { ! setActionCommand(COMMAND_FAILURE); ! fireActionEvent(); } - */ - } - - private static PopupChecker checker = null; - public void ancestorAdded(javax.swing.event.AncestorEvent event) { - //This is where we typically have a problem with popups not showing, - //and below is the cure... Problem is that the popup is hidden - //because the combo's ancestor is changed (even though we blocked - //the normal ancestor listener from being added) - checker = new PopupChecker(); - SwingUtilities.invokeLater(checker); - } ! public void ancestorMoved(javax.swing.event.AncestorEvent event) { ! //do nothing ! if (needLayout && getLayout() != null) { ! getLayout().layoutContainer(this); } - } - - public void ancestorRemoved(javax.swing.event.AncestorEvent event) { - //do nothing - } - - /** A handy runnable which will ensure the popup is really displayed */ - private class PopupChecker implements Runnable { ! public void run() { ! /* ! if (isShowing() && !isPopupVisible()) { ! log ("Popup checker ensuring editor prepared or popup visible"); ! if (isEditable()) { ! prepareEditor(); ! } else { ! showPopup(); ! } ! } ! checker = null; ! */ } - } ! public void paintChildren(Graphics g) { ! if (editor != null && !hasFocus() && editor.isPaintable()) { ! return; ! } else { ! super.paintChildren(g); } - } ! /* ! public void paintComponent (Graphics g) { ! //For property panel usage, allow the editor to paint ! if (editor != null && !hasFocus() && editor.isPaintable()) { ! Insets ins = getInsets(); ! Color c = g.getColor(); ! try { ! g.setColor(getBackground()); ! g.fillRect(0,0,getWidth(),getHeight()); ! } finally { ! g.setColor(c); ! } ! ins.left += PropUtils.getTextMargin(); ! editor.paintValue(g, new Rectangle(ins.left, ins.top, getWidth() - ! (ins.right + ins.left), getHeight() - (ins.top + ins.bottom))); ! } else { ! super.paintComponent(g); } - } - */ - - /* Replacement renderer class to hack around bug in SynthComboUI - will - * only be used on GTK look & feel. GTK does not set background/highlight - * colors correctly */ - /* - private class Renderer extends DefaultListCellRenderer { - private boolean sel=false; - /** Overridden to return the combo box's background color if selected - * and focused - in GTK L&F combo boxes are always white (there's even - * a "fixme" note in the code. - public Color getBackground() { - //This method can be called in the superclass constructor, thanks - //to updateUI(). At that time, this==null, so an NPE would happen - //if we tried tor reference the outer class - if (ComboInplaceEditor.this == null) { - return null; - } ! if (!sel && (getText() != null && getSelectedItem() != null && ! getText().equals(getSelectedItem()))) { ! return ComboInplaceEditor.this.getBackground(); ! } else { ! return super.getBackground(); ! } } ! public Component getListCellRendererComponent(JList list,Object value, ! int index, ! boolean isSelected, ! boolean cellHasFocus) { ! sel = isSelected; ! return super.getListCellRendererComponent(list, ! value, index, isSelected, cellHasFocus); } } - */ } --- 49,154 ---- protected PropertyEditor editor; protected PropertyEnv env; ! protected PropertyModel propertyModel; + private DateEditorInplace renderer; ! public void attachEnv(PropertyEnv env) { ! this.env = env; ! this.env.registerInplaceEditorFactory(this); } ! public boolean isPaintable() { ! return true; } ! public void paintValue(Graphics gfx, Rectangle box) { ! if (renderer == null) { ! renderer = new DateEditorInplace(); } ! renderer.setSize (box.width, box.height); ! renderer.doLayout(); ! Graphics g = gfx.create(box.x, box.y, box.width, box.height); ! renderer.setOpaque(true); ! renderer.paint (g); ! g.dispose(); } ! public InplaceEditor getInplaceEditor() { ! return new DateEditorInplace(); } ! public void setValue(Object value) { ! super.setValue(value); ! currentDate = (Date) value; } public Object getValue() { ! return currentDate; } + class DateEditorInplace extends CalendarComboBox implements InplaceEditor { + public DateEditorInplace() { + super(false); + super.setDate(currentDate); } ! public void connect(PropertyEditor pe, PropertyEnv env) { } ! public JComponent getComponent() { ! return this; } ! public void clear() { } ! public Object getValue() { ! return null; } ! public void setValue(Object o) { } ! public boolean supportsTextEntry() { ! return false; } ! public void reset() { } ! public void addActionListener(ActionListener al) { } ! public void removeActionListener(ActionListener al) { } ! public KeyStroke[] getKeyStrokes() { ! return new KeyStroke[0]; } ! public PropertyEditor getPropertyEditor() { ! return null; } ! public PropertyModel getPropertyModel() { ! return null; } ! public void setPropertyModel(PropertyModel pm) { } + public boolean isKnownComponent(Component c) { + return true; + } } } --- DateEditor.form DELETED --- --- ObjectNameEditor.java DELETED --- |
From: Greg H. <gh...@us...> - 2004-04-30 17:20:55
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/swing/editor/jmx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27418/src/org/mc4j/console/swing/editor/jmx Added Files: ObjectNameEditor.java ObjectNameSelector.java Log Message: Better error handling for attribute retrieval displaying null versus cannot display for transfer/serialization erros refactored the inplace editors as per the newer inplace editor model --- NEW FILE: ObjectNameSelector.java --- /* * Author: Greg Hinkle * * The contents of this file are subject to the Sapient Public License Version 1.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy of the * License at http://mc4j.sf.net/License-SPL.html. * * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, * either express or implied. See the License for the specific language governing rights and limitations * under the License. * * The Original Code is The MC4J Management Console * The Initial Developer of the Original Code is Greg Hinkle (gh...@us...) * Copyright (C) 2004 Greg Hinkle. All Rights Reserved. * * Redistributions of code or binary files using or based on this code must reproduce the * above copyright and disclaimer. For more information see <http://mc4j.sourceforge.net>. */ package org.mc4j.console.swing.editor.jmx; import javax.swing.ListModel; import javax.swing.ListSelectionModel; /** * * @author Greg Hinkle (gh...@us...), January 2002 * @version $Revision: 1.1 $($Author: ghinkl $ / $Date: 2004/04/30 17:20:45 $) */ public class ObjectNameSelector extends javax.swing.JPanel { /** Creates new form ObjectNameSelector */ public ObjectNameSelector(ListModel listModel, ListSelectionModel selectionModel) { initComponents(); this.objectNameList.setModel(listModel); this.objectNameList.setSelectionModel(selectionModel); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() {//GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; introTextLabel = new javax.swing.JLabel(); objectNameListScrollPane = new javax.swing.JScrollPane(); objectNameList = new javax.swing.JList(); setLayout(new java.awt.GridBagLayout()); setMinimumSize(new java.awt.Dimension(500, 520)); setNextFocusableComponent(objectNameList); setPreferredSize(new java.awt.Dimension(500, 540)); introTextLabel.setFont(new java.awt.Font("Dialog", 0, 12)); introTextLabel.setText("Choose an ObjectName:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(4, 8, 4, 8); gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; add(introTextLabel, gridBagConstraints); objectNameListScrollPane.setMinimumSize(null); //objectNameListScrollPane.setPreferredSize(new java.awt.Dimension(400, 131)); objectNameList.setMaximumSize(null); objectNameList.setMinimumSize(null); objectNameList.setPreferredSize(null); objectNameListScrollPane.setViewportView(objectNameList); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.insets = new java.awt.Insets(4, 8, 8, 8); gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weighty = 1.0; add(objectNameListScrollPane, gridBagConstraints); }//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JScrollPane objectNameListScrollPane; private javax.swing.JList objectNameList; private javax.swing.JLabel introTextLabel; // End of variables declaration//GEN-END:variables } --- NEW FILE: ObjectNameEditor.java --- /* * Author: Greg Hinkle * * The contents of this file are subject to the Sapient Public License Version 1.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy of the * License at http://mc4j.sf.net/License-SPL.html. * * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, * either express or implied. See the License for the specific language governing rights and limitations * under the License. * * The Original Code is The MC4J Management Console * The Initial Developer of the Original Code is Greg Hinkle (gh...@us...) * Copyright (C) 2004 Greg Hinkle. All Rights Reserved. * * Redistributions of code or binary files using or based on this code must reproduce the * above copyright and disclaimer. For more information see <http://mc4j.sourceforge.net>. */ package org.mc4j.console.swing.editor.jmx; import org.openide.ErrorManager; import org.openide.explorer.propertysheet.ExPropertyEditor; import org.openide.explorer.propertysheet.InplaceEditor; import org.openide.explorer.propertysheet.PropertyEnv; import org.openide.explorer.propertysheet.PropertyModel; import org.openide.nodes.Node; import org.mc4j.console.bean.MBeanNode; import org.mc4j.console.connection.ConnectionNode; import java.awt.Component; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.beans.PropertyEditor; import java.beans.PropertyEditorSupport; import java.util.Iterator; import java.util.List; import javax.management.ObjectName; import javax.swing.DefaultListModel; import javax.swing.DefaultListSelectionModel; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.KeyStroke; import javax.swing.ListSelectionModel; /** * @author Greg Hinkle (gh...@us...), January 2002 * @version $Revision: 1.1 $($Author: ghinkl $ / $Date: 2004/04/30 17:20:45 $) */ public class ObjectNameEditor extends PropertyEditorSupport implements ExPropertyEditor, InplaceEditor.Factory { private ObjectName currentValue; private DefaultListModel listModel; private DefaultListSelectionModel selectionModel; private PropertyEnv propertyEnv; private ConnectionNode connectionNode; public ObjectNameEditor() { this.listModel = new DefaultListModel(); this.selectionModel = new DefaultListSelectionModel(); this.selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } public void setAsText(String text) throws IllegalArgumentException { for (int i = 0; i < this.listModel.getSize(); i++) { ObjectName objectName = (ObjectName)this.listModel.get(i); String name = objectName.toString(); if (name.equals(text)) { this.currentValue = objectName; this.selectionModel.setSelectionInterval(i,i); } } } public String getAsText() { return (this.currentValue!= null)?this.currentValue.getCanonicalName():"<null>"; } public boolean supportsCustomEditor() { return true; } public Component getCustomEditor () { return new ObjectNameSelector(listModel, selectionModel); } public void attachEnv(PropertyEnv env) { this.propertyEnv = env; env.registerInplaceEditorFactory(this); Object bean = propertyEnv.getBeans()[0]; if (bean != null) { Node node = (Node) bean; while ((!(node instanceof ConnectionNode)) && (node != null)) { node = node.getParentNode(); } if (node != null) { this.connectionNode = (ConnectionNode) node; List objectInstanceList = this.connectionNode.getMBeanList(); Iterator instIter = objectInstanceList.iterator(); int i = 0; while (instIter.hasNext()) { i++; //ObjectInstance instance = (ObjectInstance) ObjectName name = ((MBeanNode)instIter.next()).getObjectName(); //instance.getObjectName(); listModel.addElement(name); if ((this.currentValue != null) && (this.currentValue.equals(name))) { this.selectionModel.setSelectionInterval(i,i); } } } } } public void setValue(Object value) { if (value != null) { this.currentValue = (ObjectName) value; firePropertyChange(); for (int i = 0; i < this.listModel.getSize(); i++) { ObjectName objectName = (ObjectName)this.listModel.get(i); if (objectName.equals(value)) { this.selectionModel.setSelectionInterval(i,i); } } } else { this.currentValue = null; } } public Object getValue() { return this.currentValue; } public boolean isPaintable() { return true; } private ObjectNameInplace renderer = null; public void paintValue(Graphics gfx, Rectangle box) { if (renderer == null) { renderer = new ObjectNameInplace(); } renderer.setText(getAsText()); renderer.setSize (box.width, box.height); renderer.doLayout(); Graphics g = gfx.create(box.x, box.y, box.width, box.height); renderer.setOpaque(false); renderer.paint (g); g.dispose(); } public InplaceEditor getInplaceEditor() { ObjectNameInplace inplace = new ObjectNameInplace(); return inplace; } public void gotoBean() { if (this.currentValue != null) this.connectionNode.browseToMBean(this.currentValue); } class ObjectNameInplace extends JButton implements InplaceEditor { private ConnectionNode connectionNode; private PropertyEditor propertyEditor; private PropertyEnv propertyEnv; private PropertyModel propertyModel; /*Keystrokes this inplace editor wants to consume */ final KeyStroke[] cbKeyStrokes = new KeyStroke[] {KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,0,false), KeyStroke.getKeyStroke(KeyEvent.VK_UP,0,false), KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,0,true), KeyStroke.getKeyStroke(KeyEvent.VK_UP,0,true), KeyStroke.getKeyStroke (KeyEvent.VK_PAGE_DOWN,0,false), KeyStroke.getKeyStroke (KeyEvent.VK_PAGE_UP,0,false), KeyStroke.getKeyStroke (KeyEvent.VK_PAGE_DOWN,0,true), KeyStroke.getKeyStroke (KeyEvent.VK_PAGE_UP,0,true) }; /** Creates a new instance of ObjectNameLink */ public ObjectNameInplace() { //setForeground(Color.red); setText(getAsText()); setToolTipText("Click to browse to managed object..."); // TODO GH: this doesn't work addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { gotoBean(); } }); } // Show the button in red and underlined? // public void setText(String text) { // super.setText("<html><u>"+text+"</u></html>"); // } public JComponent getComponent() { return this; } public void clear() { } public boolean isKnownComponent(Component c) { return (this.equals(c)); } public boolean supportsTextEntry() { return false; } public void reset() { } public void addActionListener(ActionListener al) { } public void removeActionListener(ActionListener al) { } public KeyStroke[] getKeyStrokes() { return cbKeyStrokes; } public void setValue(Object value) { if ((value != null) && (value instanceof ObjectName)) { currentValue = (ObjectName) value; setText(getAsText()); } } public Object getValue() { return currentValue; } public void connect(PropertyEditor pe, PropertyEnv env) { // Just go on activation, since the action listener doesn't work. gotoBean(); this.propertyEditor = pe; this.propertyEnv = env; } public PropertyEditor getPropertyEditor() { return this.propertyEditor; } public PropertyModel getPropertyModel() { return propertyModel; } public void setPropertyModel(PropertyModel pm) { this.propertyModel = pm; try { Object value = this.propertyModel.getValue(); if ((value != null) && (value instanceof ObjectName)) { currentValue = (ObjectName) value; } } catch(Exception e) { ErrorManager.getDefault().notify(e); } } } } |
From: Greg H. <gh...@us...> - 2004-04-30 13:26:22
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/jre15/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9522/src/org/mc4j/jre15/components Modified Files: ThreadMBeanThreadBrowserComponent.java Log Message: Stupid cut/paste error breaking build. Index: ThreadMBeanThreadBrowserComponent.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/jre15/components/ThreadMBeanThreadBrowserComponent.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ThreadMBeanThreadBrowserComponent.java 31 Mar 2004 20:02:04 -0000 1.1 --- ThreadMBeanThreadBrowserComponent.java 30 Apr 2004 13:26:13 -0000 1.2 *************** *** 19,22 **** --- 19,28 ---- package org.mc4j.jre15.components; + import org.openide.ErrorManager; + + import org.mc4j.console.Refreshable; + import org.mc4j.console.dashboard.Dashboard; + import org.mc4j.console.dashboard.DashboardComponent; + import java.awt.BorderLayout; import java.awt.Component; *************** *** 45,55 **** import javax.swing.tree.DefaultTreeModel; - import org.openide.ErrorManager; - - import org.mc4j.carbon.config.tree.ConfigurationTreeComponent; - import org.mc4j.console.Refreshable; - import org.mc4j.console.dashboard.Dashboard; - import org.mc4j.console.dashboard.DashboardComponent; - /** * This component supports viewing JVM thread information in a tree structure. It shows the thread --- 51,54 ---- *************** *** 256,260 **** /** Returns an ImageIcon, or null if the path was invalid. */ protected static ImageIcon createImageIcon(String path) { ! java.net.URL imgURL = ConfigurationTreeComponent.class.getClassLoader().getResource(path); if (imgURL != null) { return new ImageIcon(imgURL); --- 255,259 ---- /** Returns an ImageIcon, or null if the path was invalid. */ protected static ImageIcon createImageIcon(String path) { ! java.net.URL imgURL = ThreadMBeanThreadBrowserComponent.class.getClassLoader().getResource(path); if (imgURL != null) { return new ImageIcon(imgURL); |
From: Greg H. <gh...@us...> - 2004-04-26 20:03:39
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/swing/editor/jmx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32183/src/org/mc4j/console/swing/editor/jmx Log Message: Directory /cvsroot/mc4j/mc4j/src/org/mc4j/console/swing/editor/jmx added to the repository |
From: Greg H. <gh...@us...> - 2004-04-22 14:18:56
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console/swing/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32428/src/org/mc4j/console/swing/editor Modified Files: ObjectNameEditor.java Log Message: npe checks Index: ObjectNameEditor.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/swing/editor/ObjectNameEditor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ObjectNameEditor.java 19 Feb 2004 19:31:42 -0000 1.6 --- ObjectNameEditor.java 22 Apr 2004 14:18:43 -0000 1.7 *************** *** 20,23 **** --- 20,31 ---- package org.mc4j.console.swing.editor; + import org.openide.explorer.propertysheet.ExPropertyEditor; + import org.openide.explorer.propertysheet.PropertyEnv; + import org.openide.explorer.propertysheet.editors.EnhancedPropertyEditor; + import org.openide.nodes.Node; + + import org.mc4j.console.bean.MBeanNode; + import org.mc4j.console.connection.ConnectionNode; + import java.awt.Component; import java.awt.event.MouseAdapter; *************** *** 33,44 **** import javax.swing.ListSelectionModel; - import org.openide.explorer.propertysheet.ExPropertyEditor; - import org.openide.explorer.propertysheet.PropertyEnv; - import org.openide.explorer.propertysheet.editors.EnhancedPropertyEditor; - import org.openide.nodes.Node; - - import org.mc4j.console.bean.MBeanNode; - import org.mc4j.console.connection.ConnectionNode; - /** * --- 41,44 ---- *************** *** 48,52 **** public class ObjectNameEditor extends PropertyEditorSupport ! implements ExPropertyEditor, EnhancedPropertyEditor { private ConnectionNode connectionNode; --- 48,52 ---- public class ObjectNameEditor extends PropertyEditorSupport ! implements ExPropertyEditor, EnhancedPropertyEditor { // TODO GH: Translate to InplaceEditor.Factory private ConnectionNode connectionNode; *************** *** 123,141 **** Object bean = propertyEnv.getBeans()[0]; ! Node node = (Node) bean; ! while (! (node instanceof ConnectionNode)) { ! node = node.getParentNode(); ! } ! this.connectionNode = (ConnectionNode) node; ! List objectInstanceList = this.connectionNode.getMBeanList(); ! Iterator instIter = objectInstanceList.iterator(); ! while (instIter.hasNext()) { ! //ObjectInstance instance = (ObjectInstance) ! ObjectName name = ((MBeanNode)instIter.next()).getObjectName(); //instance.getObjectName(); ! model.addElement(name); } } --- 123,145 ---- Object bean = propertyEnv.getBeans()[0]; ! if (bean != null) { ! Node node = (Node) bean; ! while ((!(node instanceof ConnectionNode)) && (node != null)) { ! node = node.getParentNode(); ! } ! if (node != null) { ! this.connectionNode = (ConnectionNode) node; ! List objectInstanceList = this.connectionNode.getMBeanList(); ! Iterator instIter = objectInstanceList.iterator(); ! while (instIter.hasNext()) { ! //ObjectInstance instance = (ObjectInstance) ! ObjectName name = ((MBeanNode)instIter.next()).getObjectName(); //instance.getObjectName(); ! model.addElement(name); ! } ! } } } |
From: Greg H. <gh...@us...> - 2004-04-21 20:43:08
|
Update of /cvsroot/mc4j/mc4j/src/org/mc4j/console In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10747/src/org/mc4j/console Modified Files: IConnectionNode.java Log Message: principle->principal connection message Index: IConnectionNode.java =================================================================== RCS file: /cvsroot/mc4j/mc4j/src/org/mc4j/console/IConnectionNode.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IConnectionNode.java 7 Apr 2004 15:27:37 -0000 1.5 --- IConnectionNode.java 21 Apr 2004 20:42:46 -0000 1.6 *************** *** 40,47 **** String getDefaultInitialContext(); ! String getDefaultPrinciple(); String getDefaultCredentials(); String getConnectionType(); } --- 40,49 ---- String getDefaultInitialContext(); ! String getDefaultPrincipal(); String getDefaultCredentials(); String getConnectionType(); + + String getConnectionMessage(); } |