Search in sources :

Example 21 with IMonitoredMXBeanGroup

use of org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup in project tdi-studio-se by Talend.

the class MBeanServer method addMonitoredAttributeGroup.

/*
     * @see IMBeanServer#addMonitoredAttributeGroup(String, IMonitoredMXBeanGroup.AxisUnit)
     */
@Override
public IMonitoredMXBeanGroup addMonitoredAttributeGroup(String name, AxisUnit axisUnit) {
    Assert.isNotNull(name);
    Assert.isNotNull(axisUnit);
    for (IMonitoredMXBeanGroup group : monitoredAttributeGroups) {
        if (group.getName().equals(name)) {
            group.setAxisUnit(axisUnit);
            group.clearAttributes();
            return group;
        }
    }
    IMonitoredMXBeanGroup group = new MonitoredMXBeanGroup(this, name, axisUnit);
    monitoredAttributeGroups.add(group);
    fireMBeanServerChangeEvent(new MBeanServerEvent(MBeanServerState.MonitoredAttributeGroupAdded, group));
    return group;
}
Also used : IMonitoredMXBeanGroup(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup) IMonitoredMXBeanGroup(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup) MBeanServerEvent(org.talend.designer.runtime.visualization.MBean.MBeanServerEvent)

Example 22 with IMonitoredMXBeanGroup

use of org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup in project tdi-studio-se by Talend.

the class ConfigureChartAction method performConfiguration.

/**
     * Performs the configuration.
     * 
     * @param chartTitle The chart title
     * @param axisUnit The axis unit
     * @param attributes The attributes
     * @param removedAttributes The removed attributes
     */
private void performConfiguration(String chartTitle, AxisUnit axisUnit, List<MBeanAttribute> attributes, List<MBeanAttribute> removedAttributes) {
    IMonitoredMXBeanGroup group = chart.getAttributeGroup();
    group.setName(chartTitle);
    group.setAxisUnit(axisUnit);
    for (MBeanAttribute attribute : attributes) {
        ObjectName objectName = attribute.getObjectName();
        String attributeName = attribute.getAttributeName();
        IMonitoredMXBeanAttribute monitoredAttribute = group.getAttribute(objectName, attributeName);
        RGB rgb = attribute.getRgb();
        if (monitoredAttribute == null) {
            try {
                group.addAttribute(objectName.getCanonicalName(), attributeName, new int[] { rgb.red, rgb.green, rgb.blue });
            } catch (JvmCoreException e) {
                Activator.log(Messages.addAttributeFailedMsg, e);
            }
        } else {
            monitoredAttribute.setRGB(rgb.red, rgb.green, rgb.blue);
        }
    }
    for (MBeanAttribute removedAttribute : removedAttributes) {
        group.removeAttribute(removedAttribute.getObjectName().getCanonicalName(), removedAttribute.getAttributeName());
    }
    chart.refresh();
}
Also used : IMonitoredMXBeanGroup(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup) IMonitoredMXBeanAttribute(org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanAttribute) RGB(org.eclipse.swt.graphics.RGB) ObjectName(javax.management.ObjectName) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Aggregations

IMonitoredMXBeanGroup (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup)22 IMBeanServer (org.talend.designer.runtime.visualization.MBean.IMBeanServer)7 JvmCoreException (org.talend.designer.runtime.visualization.JvmCoreException)6 IMonitoredMXBeanAttribute (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanAttribute)6 IActiveJvm (org.talend.designer.runtime.visualization.IActiveJvm)5 ObjectName (javax.management.ObjectName)4 RGB (org.eclipse.swt.graphics.RGB)4 Date (java.util.Date)3 IMemento (org.eclipse.ui.IMemento)3 AxisUnit (org.talend.designer.runtime.visualization.MBean.IMonitoredMXBeanGroup.AxisUnit)2 MBeanServerEvent (org.talend.designer.runtime.visualization.MBean.MBeanServerEvent)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 FormAttachment (org.eclipse.swt.layout.FormAttachment)1 FormData (org.eclipse.swt.layout.FormData)1 FormLayout (org.eclipse.swt.layout.FormLayout)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)1