[Ejtools-cvs] applications/jmx.browser/src/main/org/ejtools/jmx/browser/ui MBeanCustomizer.java,1.5,
Brought to you by:
letiemble
|
From: <let...@us...> - 2003-11-27 01:13:11
|
Update of /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/ui
In directory sc8-pr-cvs1:/tmp/cvs-serv13614/jmx.browser/src/main/org/ejtools/jmx/browser/ui
Modified Files:
MBeanCustomizer.java
Log Message:
Address Bug #775745
Address Todo #800902
Address Todo #755528
Remove @created tags
Add support for MXJ4 2.0.0 (still beta)
Add support for JXM Remoting through RMI
Index: MBeanCustomizer.java
===================================================================
RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/ui/MBeanCustomizer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** MBeanCustomizer.java 6 Apr 2003 11:50:18 -0000 1.5
--- MBeanCustomizer.java 27 Nov 2003 01:13:07 -0000 1.6
***************
*** 20,25 ****
--- 20,27 ----
import java.beans.PropertyEditor;
import java.util.ArrayList;
+ import java.util.Arrays;
import java.util.Hashtable;
import java.util.Iterator;
+ import java.util.List;
import java.util.ResourceBundle;
***************
*** 38,41 ****
--- 40,44 ----
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
+ import javax.swing.SwingConstants;
import org.apache.log4j.Logger;
***************
*** 48,51 ****
--- 51,55 ----
import org.ejtools.graph.service.GraphConsumerSelector;
import org.ejtools.jmx.MBeanAccessor;
+ import org.ejtools.jmx.MBeanSorter;
import org.ejtools.jmx.browser.model.Resource;
import org.ejtools.util.ClassTools;
***************
*** 57,62 ****
*
* @author letiemble
- * @created 8 avril 2002
* @version $Revision$
* @todo Protected method to choose PropertyEditor by Class and Name
* @todo Non Supported classes displayed
--- 61,66 ----
*
* @author letiemble
* @version $Revision$
+ * @created 8 avril 2002
* @todo Protected method to choose PropertyEditor by Class and Name
* @todo Non Supported classes displayed
***************
*** 219,223 ****
// Create the attribute label
! JLabel label = new JLabel(attributeInfo.getName() + " :", JLabel.RIGHT);
label.setToolTipText(attributeInfo.getDescription());
label.setForeground(AwtToolkit.DARK_BLUE);
--- 223,227 ----
// Create the attribute label
! JLabel label = new JLabel(attributeInfo.getName() + " :", SwingConstants.RIGHT);
label.setToolTipText(attributeInfo.getDescription());
label.setForeground(AwtToolkit.DARK_BLUE);
***************
*** 357,361 ****
protected void addToGraph(String attribute)
{
! GraphConsumer consumer = GraphConsumerSelector.select(this);
if (consumer != null)
{
--- 361,365 ----
protected void addToGraph(String attribute)
{
! GraphConsumer consumer = GraphConsumerSelector.selectWithDialog(this);
if (consumer != null)
{
***************
*** 366,372 ****
/**
! * Adds a feature to the UnsupportedProperty attribute of the GenericMBeanCustomizer object
*
! * @param attributeInfo The feature to be added to the UnsupportedProperty attribute
*/
protected void addUnsupportedProperty(MBeanAttributeInfo attributeInfo)
--- 370,378 ----
/**
! * Adds a feature to the UnsupportedProperty attribute of the
! * GenericMBeanCustomizer object
*
! * @param attributeInfo The feature to be added to the UnsupportedProperty
! * attribute
*/
protected void addUnsupportedProperty(MBeanAttributeInfo attributeInfo)
***************
*** 375,379 ****
gridbagconstraints.insets = new Insets(2, 2, 2, 2);
! JLabel jlabel = new JLabel(attributeInfo.getName() + " :", JLabel.RIGHT);
jlabel.setToolTipText(attributeInfo.getDescription());
jlabel.setForeground(AwtToolkit.DARK_BLUE);
--- 381,385 ----
gridbagconstraints.insets = new Insets(2, 2, 2, 2);
! JLabel jlabel = new JLabel(attributeInfo.getName() + " :", SwingConstants.RIGHT);
jlabel.setToolTipText(attributeInfo.getDescription());
jlabel.setForeground(AwtToolkit.DARK_BLUE);
***************
*** 411,430 ****
gridbagconstraints.fill = GridBagConstraints.HORIZONTAL;
! MBeanAttributeInfo[] infos = info.getAttributes();
! if (infos.length == 0)
{
return;
}
this.mbeanAttributes = new JPanel(new GridBagLayout());
this.mbeanAttributes.setBorder(BorderFactory.createTitledBorder(resources.getString("customizer.text.attributes")));
! for (int i = 0; i < infos.length; i++)
{
PropertyEditor propertyeditor = null;
! Class c = ClassTools.getClass(infos[i].getType());
if (c == null)
{
! this.addUnsupportedProperty(infos[i]);
}
else
--- 417,439 ----
gridbagconstraints.fill = GridBagConstraints.HORIZONTAL;
! MBeanAttributeInfo[] infosArray = info.getAttributes();
! if (infosArray.length == 0)
{
return;
}
+ List infos = Arrays.asList(infosArray);
+ MBeanSorter.sortByName(infos);
this.mbeanAttributes = new JPanel(new GridBagLayout());
this.mbeanAttributes.setBorder(BorderFactory.createTitledBorder(resources.getString("customizer.text.attributes")));
! for (int i = 0; i < infos.size(); i++)
{
+ MBeanAttributeInfo attributeInfo = (MBeanAttributeInfo) infos.get(i);
PropertyEditor propertyeditor = null;
! Class c = ClassTools.getClass(attributeInfo.getType());
if (c == null)
{
! this.addUnsupportedProperty(attributeInfo);
}
else
***************
*** 434,438 ****
Class componentType = c.getComponentType();
propertyeditor = new ArrayEditor(componentType);
! this.addProperty(propertyeditor, infos[i]);
}
else
--- 443,447 ----
Class componentType = c.getComponentType();
propertyeditor = new ArrayEditor(componentType);
! this.addProperty(propertyeditor, attributeInfo);
}
else
***************
*** 443,447 ****
propertyeditor = CustomPropertyEditorManager.findEditor(String.class);
}
! this.addProperty(propertyeditor, infos[i]);
}
gridbagconstraints.weighty = 1.0D;
--- 452,456 ----
propertyeditor = CustomPropertyEditorManager.findEditor(String.class);
}
! this.addProperty(propertyeditor, attributeInfo);
}
gridbagconstraints.weighty = 1.0D;
***************
*** 519,535 ****
gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER;
! MBeanConstructorInfo[] infos = info.getConstructors();
! if (infos.length == 0)
{
return;
}
this.mbeanConstructors = new JPanel(new GridBagLayout());
this.mbeanConstructors.setBorder(BorderFactory.createTitledBorder(resources.getString("customizer.text.constructors")));
! for (int i = 0; i < infos.length; i++)
{
StringBuffer display = new StringBuffer();
! display.append(infos[i].getName());
display.append("(");
! MBeanParameterInfo[] parameters = infos[i].getSignature();
if (parameters.length > 0)
{
--- 528,548 ----
gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER;
! MBeanConstructorInfo[] infosArray = info.getConstructors();
! if (infosArray.length == 0)
{
return;
}
+ List infos = Arrays.asList(infosArray);
+ MBeanSorter.sortByName(infos);
+
this.mbeanConstructors = new JPanel(new GridBagLayout());
this.mbeanConstructors.setBorder(BorderFactory.createTitledBorder(resources.getString("customizer.text.constructors")));
! for (int i = 0; i < infos.size(); i++)
{
+ MBeanConstructorInfo ctorInfo = (MBeanConstructorInfo) infos.get(i);
StringBuffer display = new StringBuffer();
! display.append(ctorInfo.getName());
display.append("(");
! MBeanParameterInfo[] parameters = ctorInfo.getSignature();
if (parameters.length > 0)
{
***************
*** 545,550 ****
display.append(")");
! JLabel label = new JLabel(display.toString(), JLabel.LEFT);
! label.setToolTipText(infos[i].getDescription());
label.setForeground(Color.black);
this.mbeanConstructors.add(label, gridbagconstraints);
--- 558,563 ----
display.append(")");
! JLabel label = new JLabel(display.toString(), SwingConstants.LEFT);
! label.setToolTipText(ctorInfo.getDescription());
label.setForeground(Color.black);
this.mbeanConstructors.add(label, gridbagconstraints);
***************
*** 574,578 ****
gridbagconstraints.weightx = 0.0D;
gridbagconstraints.gridwidth = GridBagConstraints.RELATIVE;
! label = new JLabel(resources.getString("customizer.text.class.name") + " : ", JLabel.RIGHT);
label.setToolTipText(resources.getString("customizer.tooltip.class.name"));
label.setForeground(AwtToolkit.DARK_BLUE);
--- 587,591 ----
gridbagconstraints.weightx = 0.0D;
gridbagconstraints.gridwidth = GridBagConstraints.RELATIVE;
! label = new JLabel(resources.getString("customizer.text.class.name") + " : ", SwingConstants.RIGHT);
label.setToolTipText(resources.getString("customizer.tooltip.class.name"));
label.setForeground(AwtToolkit.DARK_BLUE);
***************
*** 581,585 ****
gridbagconstraints.weightx = 1.0D;
gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER;
! label = new JLabel(info.getClassName(), JLabel.LEFT);
label.setForeground(Color.black);
this.mbeanInfo.add(label, gridbagconstraints);
--- 594,598 ----
gridbagconstraints.weightx = 1.0D;
gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER;
! label = new JLabel(info.getClassName(), SwingConstants.LEFT);
label.setForeground(Color.black);
this.mbeanInfo.add(label, gridbagconstraints);
***************
*** 587,591 ****
gridbagconstraints.weightx = 0.0D;
gridbagconstraints.gridwidth = GridBagConstraints.RELATIVE;
! label = new JLabel(resources.getString("customizer.text.class.description") + " : ", JLabel.RIGHT);
label.setToolTipText(resources.getString("customizer.tooltip.class.description"));
label.setForeground(AwtToolkit.DARK_BLUE);
--- 600,604 ----
gridbagconstraints.weightx = 0.0D;
gridbagconstraints.gridwidth = GridBagConstraints.RELATIVE;
! label = new JLabel(resources.getString("customizer.text.class.description") + " : ", SwingConstants.RIGHT);
label.setToolTipText(resources.getString("customizer.tooltip.class.description"));
label.setForeground(AwtToolkit.DARK_BLUE);
***************
*** 594,598 ****
gridbagconstraints.weightx = 1.0D;
gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER;
! label = new JLabel(info.getDescription(), JLabel.LEFT);
label.setForeground(Color.black);
this.mbeanInfo.add(label, gridbagconstraints);
--- 607,611 ----
gridbagconstraints.weightx = 1.0D;
gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER;
! label = new JLabel(info.getDescription(), SwingConstants.LEFT);
label.setForeground(Color.black);
this.mbeanInfo.add(label, gridbagconstraints);
***************
*** 635,652 ****
gridbagconstraints.fill = GridBagConstraints.HORIZONTAL;
! MBeanNotificationInfo[] infos = info.getNotifications();
! if (infos.length == 0)
{
return;
}
this.mbeanNotifications = new JPanel(new GridBagLayout());
this.mbeanNotifications.setBorder(BorderFactory.createTitledBorder(resources.getString("customizer.text.notifications")));
! for (int i = 0; i < infos.length; i++)
{
gridbagconstraints.weightx = 0.0D;
! gridbagconstraints.gridheight = infos[i].getNotifTypes().length;
gridbagconstraints.gridwidth = GridBagConstraints.RELATIVE;
! JLabel label = new JLabel(infos[i].getName() + " ", JLabel.RIGHT);
! label.setToolTipText(infos[i].getDescription());
label.setForeground(AwtToolkit.DARK_BLUE);
this.mbeanNotifications.add(label, gridbagconstraints);
--- 648,669 ----
gridbagconstraints.fill = GridBagConstraints.HORIZONTAL;
! MBeanNotificationInfo[] infosArray = info.getNotifications();
! if (infosArray.length == 0)
{
return;
}
+ List infos = Arrays.asList(infosArray);
+ MBeanSorter.sortByName(infos);
+
this.mbeanNotifications = new JPanel(new GridBagLayout());
this.mbeanNotifications.setBorder(BorderFactory.createTitledBorder(resources.getString("customizer.text.notifications")));
! for (int i = 0; i < infos.size(); i++)
{
+ MBeanNotificationInfo notificationInfo = (MBeanNotificationInfo) infos.get(i);
gridbagconstraints.weightx = 0.0D;
! gridbagconstraints.gridheight = notificationInfo.getNotifTypes().length;
gridbagconstraints.gridwidth = GridBagConstraints.RELATIVE;
! JLabel label = new JLabel(notificationInfo.getName() + " ", SwingConstants.RIGHT);
! label.setToolTipText(notificationInfo.getDescription());
label.setForeground(AwtToolkit.DARK_BLUE);
this.mbeanNotifications.add(label, gridbagconstraints);
***************
*** 655,661 ****
gridbagconstraints.gridheight = 1;
gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER;
! for (int j = 0; j < infos[i].getNotifTypes().length; j++)
{
! label = new JLabel(infos[i].getNotifTypes()[j], JLabel.LEFT);
label.setForeground(Color.black);
this.mbeanNotifications.add(label, gridbagconstraints);
--- 672,678 ----
gridbagconstraints.gridheight = 1;
gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER;
! for (int j = 0; j < notificationInfo.getNotifTypes().length; j++)
{
! label = new JLabel(notificationInfo.getNotifTypes()[j], SwingConstants.LEFT);
label.setForeground(Color.black);
this.mbeanNotifications.add(label, gridbagconstraints);
***************
*** 750,768 ****
gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER;
! MBeanOperationInfo[] infos = info.getOperations();
! if (infos.length == 0)
{
return;
}
this.mbeanOperations = new JPanel(new GridBagLayout());
this.mbeanOperations.setBorder(BorderFactory.createTitledBorder(resources.getString("customizer.text.operations")));
! for (int i = 0; i < infos.length; i++)
{
! MBeanOperationInfo operationInfo = infos[i];
gridbagconstraints.weightx = 0.0D;
gridbagconstraints.gridwidth = 1;
String returnType = ClassTools.classDisplay(operationInfo.getReturnType() + " ");
! JLabel label = new JLabel(returnType, JLabel.RIGHT);
label.setForeground(AwtToolkit.DARK_BLUE);
this.mbeanOperations.add(label, gridbagconstraints);
--- 767,788 ----
gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER;
! MBeanOperationInfo[] infosArray = info.getOperations();
! if (infosArray.length == 0)
{
return;
}
+ List infos = Arrays.asList(infosArray);
+ MBeanSorter.sortByName(infos);
+
this.mbeanOperations = new JPanel(new GridBagLayout());
this.mbeanOperations.setBorder(BorderFactory.createTitledBorder(resources.getString("customizer.text.operations")));
! for (int i = 0; i < infos.size(); i++)
{
! MBeanOperationInfo operationInfo = (MBeanOperationInfo) infos.get(i);
gridbagconstraints.weightx = 0.0D;
gridbagconstraints.gridwidth = 1;
String returnType = ClassTools.classDisplay(operationInfo.getReturnType() + " ");
! JLabel label = new JLabel(returnType, SwingConstants.RIGHT);
label.setForeground(AwtToolkit.DARK_BLUE);
this.mbeanOperations.add(label, gridbagconstraints);
***************
*** 787,791 ****
gridbagconstraints.weightx = 1.0D;
gridbagconstraints.gridwidth = GridBagConstraints.RELATIVE;
! label = new JLabel(display.toString(), JLabel.LEFT);
label.setToolTipText(operationInfo.getDescription());
label.setForeground(Color.black);
--- 807,811 ----
gridbagconstraints.weightx = 1.0D;
gridbagconstraints.gridwidth = GridBagConstraints.RELATIVE;
! label = new JLabel(display.toString(), SwingConstants.LEFT);
label.setToolTipText(operationInfo.getDescription());
label.setForeground(Color.black);
***************
*** 843,848 ****
*
* @author letiembl
- * @created 21 novembre 2002
* @version $Revision$
*/
protected class Updater
--- 863,868 ----
*
* @author letiembl
* @version $Revision$
+ * @created 21 novembre 2002
*/
protected class Updater
***************
*** 892,901 ****
{
Object newValue = this.editor.getValue();
! if ((newValue != null) && (this.info.isReadable()))
{
! Object oldValue = MBeanCustomizer.this.object.getAttribute(this.info.getName());
! if (!newValue.equals(oldValue))
{
- Attribute attr = new Attribute(this.info.getName(), newValue);
MBeanCustomizer.this.object.setAttribute(attr);
}
--- 912,928 ----
{
Object newValue = this.editor.getValue();
! if (newValue != null)
{
! Attribute attr = new Attribute(this.info.getName(), newValue);
! if (this.info.isReadable())
! {
! Object oldValue = MBeanCustomizer.this.object.getAttribute(this.info.getName());
! if (!newValue.equals(oldValue))
! {
! MBeanCustomizer.this.object.setAttribute(attr);
! }
! }
! else
{
MBeanCustomizer.this.object.setAttribute(attr);
}
***************
*** 910,912 ****
}
}
-
--- 937,938 ----
|