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