當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。