当前位置: 首页>>代码示例>>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;未经允许,请勿转载。