本文整理匯總了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());
}