Examples of PropertyEditor


Examples of java.beans.PropertyEditor

    }
    else
    {
      try
      {
        final PropertyEditor propertyEditor = attributeMetaData.getEditor();
        if (propertyEditor != null)
        {
          propertyEditor.setAsText(attributeValue);
          element.setAttribute(namespace, name, propertyEditor.getValue());
        }
        else
        {
          final ConverterRegistry instance = ConverterRegistry.getInstance();
          final ValueConverter valueConverter = instance.getValueConverter(type);
View Full Code Here

Examples of java.beans.PropertyEditor

          attList.addNamespaceDeclaration("autoGenNs", namespace);
        }

        try
        {
          final PropertyEditor propertyEditor = attrMeta.getEditor();
          final String textValue;
          if (propertyEditor != null)
          {
            propertyEditor.setValue(value);
            textValue = propertyEditor.getAsText();
          }
          else
          {
            textValue = ConverterRegistry.toAttributeValue(value);
View Full Code Here

Examples of java.beans.PropertyEditor

                editorClass = defaultEditorClass;
            }

            // instantiate PropertyEditor
            Class propertyEditorClass = null;
            PropertyEditor editor = null;
            try {
                propertyEditorClass = Class.forName(editorClass);
                editor = (PropertyEditor) propertyEditorClass.newInstance();
                if (editor instanceof PropertyConsumer) {
                    ((PropertyConsumer) editor).setProperties(marker, info);
                }
                editors.put(prop, editor);
            } catch (Exception e) {
                e.printStackTrace();
                editorClass = null;
            }

            Component editorFace = null;
            if (editor != null && editor.supportsCustomEditor()) {
                editorFace = editor.getCustomEditor();
            } else {
                editorFace = new JLabel("Does not support custom editor");
            }

            if (editor != null) {
                Object propVal = props.get(prop);
                if (Debug.debugging("inspector")) {
                    Debug.output("Inspector loading " + prop + "(" + propVal
                            + ")");
                }
                editor.setValue(propVal);
            }

            // Customized labels for each property, instead of the
            // abbreviated nature of the true property names.
            String labelMarker = marker + PropertyConsumer.LabelEditorProperty;
View Full Code Here

Examples of java.beans.PropertyEditor

        Properties props = new Properties();

        Iterator values = editors.keySet().iterator();
        while (values.hasNext()) {
            String key = (String) values.next();
            PropertyEditor editor = (PropertyEditor) editors.get(key);
            if (editor != null) {
                String stuff = editor.getAsText();
                // If it's not defined with text, don't put it in the
                // properties. The layer should handle this and use
                // its default settings.
                if (stuff != null && !stuff.equals("")) {
                    props.put(key, stuff);
View Full Code Here

Examples of java.beans.PropertyEditor

              e.setAttribute(namespace, name, null);
            }
            else
            {

              final PropertyEditor propertyEditor = attribute.getEditor();
              if (propertyEditor != null)
              {
                propertyEditor.setAsText(String.valueOf(value));
                e.setAttribute(namespace, name, propertyEditor.getValue());
              }
              else
              {
                try
                {
View Full Code Here

Examples of java.beans.PropertyEditor

        reader.loadBeanDefinitions(res);
             
        editor = new JaxbPropertyEditor();
        registerCustomEditor(String.class, editor);
       
        PropertyEditor pe = null;
       
        pe = new JaxbBigIntegerEditor()
        registerCustomEditor(BigInteger.class, pe);
       
        pe = new JaxbBooleanEditor();
View Full Code Here

Examples of java.beans.PropertyEditor

import org.springframework.core.io.UrlResource;

public class CustomPropertyEditorsTest extends TestCase {  
   
    public void testJaxbPropertyEditorGetAsText() {
        PropertyEditor pe = new JaxbPropertyEditor();
        assertNull(pe.getValue());
        assertNull(pe.getAsText());
        pe.setValue("abc");
        assertEquals("abc", pe.getAsText())
        Element element = EasyMock.createMock(Element.class);
        element.getTextContent();
        EasyMock.expectLastCall().andReturn("xyz");
        EasyMock.replay(element);
        pe.setValue(element);
        assertEquals("xyz", pe.getAsText());
        EasyMock.verify(element);
    }
View Full Code Here

Examples of java.beans.PropertyEditor

        assertEquals("xyz", pe.getAsText());
        EasyMock.verify(element);
    }
   
    public void testJaxbPropertyEditorSetAsText() {
        PropertyEditor pe = new JaxbPropertyEditor();
        assertNull(pe.getValue());
        assertNull(pe.getAsText());
        pe.setAsText("abc");
        assertEquals("abc", pe.getAsText());
        pe.setValue(Boolean.TRUE);
        try {
            pe.setAsText("false");
            fail("Expected IllegalArgumentException not thrown.");
        } catch (IllegalArgumentException ex) {
            // ignore
        }
        pe.setValue("boolean");
        pe.setAsText("false");
        assertEquals("false", pe.getAsText());     
    }
View Full Code Here

Examples of java.beans.PropertyEditor

        pe.setAsText("false");
        assertEquals("false", pe.getAsText());     
    }
   
    public void testJaxbPropertyEditorGetValue() throws JAXBException {
        PropertyEditor pe = new JaxbPropertyEditor();
        helpTestGetValue(pe, Boolean.TRUE, "address");
    }
View Full Code Here

Examples of java.beans.PropertyEditor

        PropertyEditor pe = new JaxbPropertyEditor();
        helpTestGetValue(pe, Boolean.TRUE, "address");
    }
   
    public void testJaxbBigIntegerEditorsetAsText() {
        PropertyEditor pe = new JaxbBigIntegerEditor();
        pe.setAsText("12345");
        Object o = pe.getValue();
        assertTrue(o instanceof BigInteger);
        assertEquals(12345, ((BigInteger)o).intValue());
    }
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.