Examples of IAttributeControlFactory


Examples of net.jmesnil.jmx.ui.extensions.IAttributeControlFactory

    public static Control createControl(final Composite parent, final Object value,
            final String type, final String objectName, final String attributeName,
            final boolean writable, final IWritableAttributeHandler handler,
            final FormToolkit toolkit) {
        IAttributeControlFactory factory = null;

        if (objectName != null && attributeName != null) {
            Map<Pattern, IAttributeControlFactory> patterns = patternFactories.get(attributeName);
            if (patterns != null) {
                for (Map.Entry<Pattern, IAttributeControlFactory> entry : patterns.entrySet()) {
                    if (entry.getKey().matcher(objectName).matches()) {
                        factory = entry.getValue();
                    }
                }
            }
        }
       
        if (factory == null) {
          Class<? extends Object> clazz = value == null ? getClass(type) : value.getClass();
          if (clazz == null) {
            factory = defaultFactory;
          } else {
                List<IAttributeControlFactory> factories = findFactories(clazz);
                if (factories == null) {
                    factory = value.getClass().isArray() ? arrayFactory : defaultFactory;
                } else {
                    factory = factories.get(0);
                }
          }
        }
       
        return factory.createControl(parent, toolkit, writable, type, value, handler);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.