本文整理汇总了Java中java.beans.PropertyEditorSupport.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyEditorSupport.setValue方法的具体用法?Java PropertyEditorSupport.setValue怎么用?Java PropertyEditorSupport.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.PropertyEditorSupport
的用法示例。
在下文中一共展示了PropertyEditorSupport.setValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPropertyEditorSupport
import java.beans.PropertyEditorSupport; //导入方法依赖的package包/类
/**
* @tests java.beans.PropertyEditorSupport#PropertyEditorSupport()
*/
public void testPropertyEditorSupport() {
// Regression for HARMONY-516
PropertyEditorSupport support = new PropertyEditorSupport();
assertEquals("null", support.getAsText());
assertNull(support.getValue());
assertNull(support.getCustomEditor());
assertEquals("???", support.getJavaInitializationString());
assertNull(support.getTags());
assertFalse(support.supportsCustomEditor());
assertFalse(support.isPaintable());
assertSame(support, support.getSource());
Object value = new String[] { "java.awt.Color.orange" };
support.setValue(value);
assertEquals(value.toString(), support.getAsText());
}
示例2: testSetValue_null
import java.beans.PropertyEditorSupport; //导入方法依赖的package包/类
public void testSetValue_null() {
PropertyEditorSupport support = new PropertyEditorSupport();
support.setValue(null);
assertNull(support.getValue());
assertEquals("null", support.getAsText());
assertNull(support.getCustomEditor());
assertEquals("???", support.getJavaInitializationString());
assertNull(support.getTags());
assertFalse(support.supportsCustomEditor());
assertFalse(support.isPaintable());
MockTarget target = new MockTarget();
support.setValue(target);
assertSame(target, support.getValue());
assertEquals(target.toString(), support.getAsText());
assertNull(support.getCustomEditor());
assertEquals("???", support.getJavaInitializationString());
assertNull(support.getTags());
assertFalse(support.supportsCustomEditor());
assertFalse(support.isPaintable());
}
示例3: testSetValue_Event
import java.beans.PropertyEditorSupport; //导入方法依赖的package包/类
public void testSetValue_Event() {
PropertyEditorSupport support = new PropertyEditorSupport();
Object source = new Object();
support.setSource(source);
MockPropertyChangeListener listener = new MockPropertyChangeListener();
support.addPropertyChangeListener(listener);
support.setValue(new Object());
PropertyChangeEvent event = listener.getEvent();
assertNotNull(event);
assertEquals(source, event.getSource());
assertNull(event.getNewValue());
assertNull(event.getOldValue());
assertNull(event.getPropagationId());
assertNull(event.getPropertyName());
}
示例4: testSetValue
import java.beans.PropertyEditorSupport; //导入方法依赖的package包/类
public void testSetValue() {
PropertyEditorSupport support = new PropertyEditorSupport();
String[] value = new String[] { "This is a sample value." };
support.setValue(value);
assertEquals(value, support.getValue());
assertEquals(value.toString(), support.getAsText());
assertNull(support.getCustomEditor());
assertEquals("???", support.getJavaInitializationString());
assertNull(support.getTags());
assertFalse(support.supportsCustomEditor());
assertFalse(support.isPaintable());
}