當前位置: 首頁>>代碼示例>>Java>>正文


Java PropertyEditor.getValue方法代碼示例

本文整理匯總了Java中java.beans.PropertyEditor.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java PropertyEditor.getValue方法的具體用法?Java PropertyEditor.getValue怎麽用?Java PropertyEditor.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.beans.PropertyEditor的用法示例。


在下文中一共展示了PropertyEditor.getValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: commitChanges0

import java.beans.PropertyEditor; //導入方法依賴的package包/類
private Object commitChanges0() {
    int currentIndex = editorsCombo.getSelectedIndex();
    PropertyEditor currentEditor = currentIndex > -1 ? allEditors[currentIndex] : null;
    if (currentEditor != null) {
        // assuming the editor already has the new value set through PropertyEnv listener
        Object value = currentEditor.getValue();
        if (editor.getProperty().canWrite()) { // issue 83770
            // create a special "value with editor" to switch the current
            // editor in FormProperty
            if (editor.getPropertyEnv() == null) {
                value = new FormProperty.ValueWithEditor(value, currentEditor, true);
            } else {
                Object[] nodes = editor.getPropertyEnv().getBeans();
                if (nodes == null || nodes.length <= 1) {
                    value = new FormProperty.ValueWithEditor(value, currentEditor, true);
                }
                else { // there are more nodes selected
                    value = new FormProperty.ValueWithEditor(value, currentIndex, true);
                }
            }
        }
        return value;
    }
    return BeanSupport.NO_VALUE;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:FormCustomEditor.java

示例2: isValueModified

import java.beans.PropertyEditor; //導入方法依賴的package包/類
public boolean isValueModified() {
    PropertyEditor editor = getPropertyEditor();
    boolean result = editor.getValue() != originalValue;

    if (!result && editor instanceof EnhancedCustomPropertyEditor) {
        Object entered = ((EnhancedCustomPropertyEditor) editor).getPropertyValue();

        if (entered != null) {
            result = entered.equals(originalValue);
        } else {
            result = originalValue == null;
        }
    }

    return result;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:CustomEditorDisplayer.java

示例3: getValueFromPropertyEditorManager

import java.beans.PropertyEditor; //導入方法依賴的package包/類
public static Object getValueFromPropertyEditorManager(
                 Class<?> attrClass, String attrName, String attrValue) 
    throws JasperException 
{
    try {
        PropertyEditor propEditor = 
            PropertyEditorManager.findEditor(attrClass);
        if (propEditor != null) {
            propEditor.setAsText(attrValue);
            return propEditor.getValue();
        } else {
            throw new IllegalArgumentException(
                Localizer.getMessage("jsp.error.beans.propertyeditor.notregistered"));
        }
    } catch (IllegalArgumentException ex) {
        throw new JasperException(
            Localizer.getMessage("jsp.error.beans.property.conversion",
                                 attrValue, attrClass.getName(), attrName,
                                 ex.getMessage()));
    }
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:22,代碼來源:JspRuntimeLibrary.java

示例4: getValueFromBeanInfoPropertyEditor

import java.beans.PropertyEditor; //導入方法依賴的package包/類
public static Object getValueFromBeanInfoPropertyEditor(
                       Class<?> attrClass, String attrName, String attrValue,
                       Class<?> propertyEditorClass) 
    throws JasperException 
{
    try {
        PropertyEditor pe =
            (PropertyEditor)propertyEditorClass.newInstance();
        pe.setAsText(attrValue);
        return pe.getValue();
    } catch (Exception ex) {
        throw new JasperException(
            Localizer.getMessage("jsp.error.beans.property.conversion",
                                 attrValue, attrClass.getName(), attrName,
                                 ex.getMessage()));
    }
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:18,代碼來源:JspRuntimeLibrary.java

示例5: btnSelectFontActionPerformed

import java.beans.PropertyEditor; //導入方法依賴的package包/類
private void btnSelectFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectFontActionPerformed
    PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
    if (pe != null) {
        pe.setValue(outputOptions.getFont());
        DialogDescriptor dd = new DialogDescriptor(pe.getCustomEditor(),
                NbBundle.getMessage(Controller.class,
                "LBL_Font_Chooser_Title"));                         //NOI18N
        String defaultFont = NbBundle.getMessage(Controller.class,
                "BTN_Defaul_Font");                                 //NOI18N
        dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION,
                    defaultFont, DialogDescriptor.CANCEL_OPTION});  //NOI18N
        DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
        if (dd.getValue() == DialogDescriptor.OK_OPTION) {
            Font f = (Font) pe.getValue();
            outputOptions.setFont(f);
        } else if (dd.getValue() == defaultFont) {
            outputOptions.setFont(null);
        }
        updateFontField();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:OutputSettingsPanel.java

示例6: getValueFromPropertyEditorManager

import java.beans.PropertyEditor; //導入方法依賴的package包/類
public static Object getValueFromPropertyEditorManager(Class<?> attrClass, String attrName, String attrValue)
		throws JasperException {
	try {
		PropertyEditor propEditor = PropertyEditorManager.findEditor(attrClass);
		if (propEditor != null) {
			propEditor.setAsText(attrValue);
			return propEditor.getValue();
		} else {
			throw new IllegalArgumentException(
					Localizer.getMessage("jsp.error.beans.propertyeditor.notregistered"));
		}
	} catch (IllegalArgumentException ex) {
		throw new JasperException(Localizer.getMessage("jsp.error.beans.property.conversion", attrValue,
				attrClass.getName(), attrName, ex.getMessage()));
	}
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:17,代碼來源:JspRuntimeLibrary.java

示例7: getValueFromPropertyEditorManager

import java.beans.PropertyEditor; //導入方法依賴的package包/類
public static Object getValueFromPropertyEditorManager(
             Class attrClass, String attrName, String attrValue) 
throws JasperException 
   {
try {
    PropertyEditor propEditor = 
	PropertyEditorManager.findEditor(attrClass);
    if (propEditor != null) {
	propEditor.setAsText(attrValue);
	return propEditor.getValue();
    } else {
	throw new IllegalArgumentException(
                   Localizer.getMessage("jsp.error.beans.propertyeditor.notregistered"));
    }
} catch (IllegalArgumentException ex) {
    throw new JasperException(
               Localizer.getMessage("jsp.error.beans.property.conversion",
			     attrValue, attrClass.getName(), attrName,
			     ex.getMessage()));
}
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:JspRuntimeLibrary.java

示例8: getValueFromBeanInfoPropertyEditor

import java.beans.PropertyEditor; //導入方法依賴的package包/類
public static Object getValueFromBeanInfoPropertyEditor(
	           Class attrClass, String attrName, String attrValue,
		   Class propertyEditorClass) 
throws JasperException 
   {
try {
    PropertyEditor pe = (PropertyEditor)propertyEditorClass.newInstance();
    pe.setAsText(attrValue);
    return pe.getValue();
} catch (Exception ex) {
    throw new JasperException(
               Localizer.getMessage("jsp.error.beans.property.conversion",
			     attrValue, attrClass.getName(), attrName,
			     ex.getMessage()));
}
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:JspRuntimeLibrary.java

示例9: testPropertyEditorOnValue

import java.beans.PropertyEditor; //導入方法依賴的package包/類
/**
 * Test if the property editor can act on the provided value. We can never be sure. :-(
 * @param propertyEditor
 * @param valueMirror
 * @return the property editor, or <code>null</code>
 */
private static PropertyEditor testPropertyEditorOnValue(PropertyEditor propertyEditor, Object valueMirror) {
    propertyEditor.setValue(valueMirror);
    Object value = propertyEditor.getValue();
    if (value != valueMirror && (value == null || !value.equals(valueMirror))) {
        // Returns something that we did not set. Give up.
        return null;
    }
    return propertyEditor;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:ValuePropertyEditor.java

示例10: parseImp

import java.beans.PropertyEditor; //導入方法依賴的package包/類
@Override
public Object parseImp(String input, ParserHelper helper) {
    PropertyEditor editor = findEditor(helper.getRawTargetClass());
    if (editor == null) {
        return TRY_NEXT;
    }
    editor.setAsText(input);
    return editor.getValue();
}
 
開發者ID:Yoio,項目名稱:X4J,代碼行數:10,代碼來源:DynamicParsers.java

示例11: testNullValueSupport

import java.beans.PropertyEditor; //導入方法依賴的package包/類
public void testNullValueSupport() throws Exception {
    NP np = new NP();
    String defaultValue = "<null value>";
    String customValue = "Hello world!";
    np.setValue(ObjectEditor.PROP_NULL, defaultValue);
    
    PropertyEditor p = np.getPropertyEditor();
    assertNotNull("There is some editor", p);
    assertEquals("It is StringEditor", StringEditor.class, p.getClass());
    ((StringEditor) p).readEnv(np);
    
    p.setValue(null);
    String value = (String)p.getValue ();
    assertNull(value);
    assertEquals(defaultValue, p.getAsText());

    p.setValue(customValue);
    value = (String)p.getValue ();
    assertEquals(customValue, value);
    assertEquals(customValue, p.getAsText());

    np.setValue(ObjectEditor.PROP_NULL, Boolean.TRUE);
    ((StringEditor) p).readEnv(np);
    p.setValue(null);
    value = (String)p.getValue ();
    assertNull(value);
    assertFalse("we've better than default 'null' string", "null".equals(defaultValue));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:StringEditorTest.java

示例12: setAsText

import java.beans.PropertyEditor; //導入方法依賴的package包/類
public Object setAsText(final String str) {
    final PropertyEditor editor = fetchFromPool();
    try {
        editor.setAsText(str);
        return editor.getValue();
    } finally {
        pool.putInPool(editor);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:ThreadSafePropertyEditor.java

示例13: NbClassPathCustomEditor

import java.beans.PropertyEditor; //導入方法依賴的package包/類
NbClassPathCustomEditor(PropertyEditor propEd) {
    this();
    editor = propEd;
    Object value = propEd.getValue();
    if (value instanceof NbClassPath) {
        setClassPath(((NbClassPath)value).getClassPath());
    }
    if ( editor instanceof NbClassPathEditor )
        if ( ! ((NbClassPathEditor)editor).isEditable() ) {
            editable = false;
            addDirButton.setEnabled( false );
            addJarButton.setEnabled( false );
        }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:NbClassPathCustomEditor.java

示例14: getValueFromPropertyEditorManager

import java.beans.PropertyEditor; //導入方法依賴的package包/類
private static Object getValueFromPropertyEditorManager(Class attrClass, String attrValue) {
	PropertyEditor propEditor = PropertyEditorManager.findEditor(attrClass);
	if (propEditor != null) {
		propEditor.setAsText(attrValue);
		return propEditor.getValue();
	} else {
		throw new IllegalArgumentException("beans property editor not registered");
	}
}
 
開發者ID:profullstack,項目名稱:spring-seed,代碼行數:10,代碼來源:BeanPropertyUtil.java

示例15: getValueFromBeanInfoPropertyEditor

import java.beans.PropertyEditor; //導入方法依賴的package包/類
private static Object getValueFromBeanInfoPropertyEditor(String attrValue, Class propertyEditorClass)
	throws IllegalAccessException, InstantiationException {
		PropertyEditor pe = (PropertyEditor) propertyEditorClass.newInstance();
		pe.setAsText(attrValue);
		return pe.getValue();

}
 
開發者ID:profullstack,項目名稱:spring-seed,代碼行數:8,代碼來源:BeanPropertyUtil.java


注:本文中的java.beans.PropertyEditor.getValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。