当前位置: 首页>>代码示例>>Java>>正文


Java PropertyEditorSupport.setValue方法代码示例

本文整理汇总了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());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:PropertyEditorSupportTest.java

示例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());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:PropertyEditorSupportTest.java

示例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());        
}
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:PropertyEditorSupportTest.java

示例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());

}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:PropertyEditorSupportTest.java


注:本文中的java.beans.PropertyEditorSupport.setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。