private static PropertyEditor findThePropertyEditor(Class clazz) {
PropertyEditor pe;
if (Object.class.equals(clazz)) {
pe = null;
} else {
pe = PropertyEditorManager.findEditor(clazz);
if (pe == null) {
Class sclazz = clazz.getSuperclass();
if (sclazz != null) {
pe = findPropertyEditor(sclazz);
}
}
}
classesWithPE.put(clazz, pe != null);
return pe;
}
java类java.beans.PropertyEditorManager的实例源码
ValuePropertyEditor.java 文件源码
项目:incubator-netbeans
阅读 23
收藏 0
点赞 0
评论 0
TermOptionsPanel.java 文件源码
项目:incubator-netbeans
阅读 18
收藏 0
点赞 0
评论 0
private void fontButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fontButtonActionPerformed
PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
if (pe != null) {
pe.setValue(termOptions.getFont());
DialogDescriptor dd = new DialogDescriptor(pe.getCustomEditor(), FontChooser_title());
String defaultFontString = FontChooser_defaultFont_label();
dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION,
defaultFontString, DialogDescriptor.CANCEL_OPTION}); //NOI18N
DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
if (dd.getValue() == DialogDescriptor.OK_OPTION) {
Font f = (Font) pe.getValue();
termOptions.setFont(f);
applyTermOptions();
} else if (dd.getValue() == defaultFontString) {
Font controlFont = UIManager.getFont("controlFont"); //NOI18N
int fontSize = (controlFont == null) ? 12 : controlFont.getSize();
termOptions.setFont(new Font("monospaced", Font.PLAIN, fontSize)); //NOI18N
}
}
}
PELookupTest.java 文件源码
项目:incubator-netbeans
阅读 16
收藏 0
点赞 0
评论 0
public void testPackageUnregistering() {
MockLookup.setInstances(new NodesRegistrationSupport.PEPackageRegistration("test1.pkg"));
NodeOp.registerPropertyEditors();
MockLookup.setInstances(new NodesRegistrationSupport.PEPackageRegistration("test2.pkg"));
String[] editorSearchPath = PropertyEditorManager.getEditorSearchPath();
int count = 0;
for (int i = 0; i < editorSearchPath.length; i++) {
assertNotSame("test1.pkg", editorSearchPath[i]);
if ("test2.pkg".equals(editorSearchPath[i])) {
count++;
}
}
assertEquals(1, count);
}
OutputSettingsPanel.java 文件源码
项目:incubator-netbeans
阅读 27
收藏 0
点赞 0
评论 0
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();
}
}
Introspector.java 文件源码
项目:Pogamut3
阅读 23
收藏 0
点赞 0
评论 0
public static Property getProperty(Field field, Object object) {
// access also protected and private fields
field.setAccessible(true);
// Properties are only primitive types marked by Prop annotation
if (field.isAnnotationPresent(JProp.class)) {
// We require that class of the field to be loaded, because we often specify
// the PropertyEditor there in static block.
forceInitialization(field.getType());
//TODO this condition should be used on client when deciding whether to show an editor for it
if (PropertyEditorManager.findEditor(field.getType()) != null) {
// add the property
return new JavaProperty(object, field);
}
}
return null;
}
PropertyEditorRegistry.java 文件源码
项目:neoscada
阅读 19
收藏 0
点赞 0
评论 0
/**
* @param requiredType
* @param propertyPath
* @return
*/
public PropertyEditor findCustomEditor ( final Class<?> requiredType, final String propertyPath )
{
// first try to find exact match
String key = requiredType.getCanonicalName () + ":" + propertyPath;
PropertyEditor pe = this.propertyEditors.get ( key );
// 2nd: try to find for class only
if ( pe == null )
{
key = requiredType.getCanonicalName () + ":";
pe = this.propertyEditors.get ( key );
}
// 3rd: try to get internal
if ( pe == null )
{
pe = PropertyEditorManager.findEditor ( requiredType );
}
return pe;
}
JspRuntimeLibrary.java 文件源码
项目:tomcat7
阅读 30
收藏 0
点赞 0
评论 0
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()));
}
}
JspRuntimeLibrary.java 文件源码
项目:lams
阅读 30
收藏 0
点赞 0
评论 0
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()));
}
}
JspRuntimeLibrary.java 文件源码
项目:apache-tomcat-7.0.73-with-comment
阅读 32
收藏 0
点赞 0
评论 0
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()));
}
}
FontChooserDialog.java 文件源码
项目:MaxSim
阅读 19
收藏 0
点赞 0
评论 0
public static Font show(Font initialFont) {
PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
if (pe == null) {
throw new RuntimeException("Could not find font editor component.");
}
pe.setValue(initialFont);
DialogDescriptor dd = new DialogDescriptor(
pe.getCustomEditor(),
"Choose Font");
DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
if (dd.getValue() == DialogDescriptor.OK_OPTION) {
Font f = (Font)pe.getValue();
return f;
}
return initialFont;
}
Test6963811.java 文件源码
项目:jdk8u-jdk
阅读 20
收藏 0
点赞 0
评论 0
public void run() {
try {
Thread.sleep(this.time); // increase the chance of the deadlock
if (this.sync) {
synchronized (Test6963811.class) {
PropertyEditorManager.findEditor(Super.class);
}
}
else {
PropertyEditorManager.findEditor(Sub.class);
}
}
catch (Exception exception) {
exception.printStackTrace();
}
}
Test6963811.java 文件源码
项目:openjdk-jdk10
阅读 17
收藏 0
点赞 0
评论 0
public void run() {
try {
Thread.sleep(this.time); // increase the chance of the deadlock
if (this.sync) {
synchronized (Test6963811.class) {
PropertyEditorManager.findEditor(Super.class);
}
}
else {
PropertyEditorManager.findEditor(Sub.class);
}
}
catch (Exception exception) {
exception.printStackTrace();
}
}
JspRuntimeLibrary.java 文件源码
项目:lazycat
阅读 29
收藏 0
点赞 0
评论 0
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()));
}
}
Test6963811.java 文件源码
项目:openjdk9
阅读 16
收藏 0
点赞 0
评论 0
public void run() {
try {
Thread.sleep(this.time); // increase the chance of the deadlock
if (this.sync) {
synchronized (Test6963811.class) {
PropertyEditorManager.findEditor(Super.class);
}
}
else {
PropertyEditorManager.findEditor(Sub.class);
}
}
catch (Exception exception) {
exception.printStackTrace();
}
}
JspRuntimeLibrary.java 文件源码
项目:beyondj
阅读 24
收藏 0
点赞 0
评论 0
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()));
}
}
PropertyEditorProvider.java 文件源码
项目:eva2
阅读 16
收藏 0
点赞 0
评论 0
/**
* Retrieve an editor object for a given class.
* This method seems unable to retrieve a primitive editor for obscure reasons.
* So better use the one based on PropertyDescriptor if possible.
*/
public static PropertyEditor findEditor(Class<?> cls) {
PropertyEditor editor = PropertyEditorManager.findEditor(cls);
// Try to unwrap primitives
if (editor == null && Primitives.isWrapperType(cls)) {
editor = PropertyEditorManager.findEditor(Primitives.unwrap(cls));
}
if ((editor == null) && useDefaultGOE) {
if (cls.isArray()) {
Class<?> unwrapped = Primitives.isWrapperType(cls.getComponentType()) ? Primitives.unwrap(cls.getComponentType()) : cls;
if (unwrapped.isPrimitive()) {
editor = new ArrayEditor();
} else {
editor = new ObjectArrayEditor<>(unwrapped.getComponentType());
}
} else if (cls.isEnum()) {
editor = new EnumEditor();
} else {
editor = new GenericObjectEditor();
((GenericObjectEditor)editor).setClassType(cls);
}
}
return editor;
}
LocalenbPanel.java 文件源码
项目:netbeansplugins
阅读 15
收藏 0
点赞 0
评论 0
/**
* Load values from the LocaleOption
*/
void load() {
final LocaleOption localeOption = LocaleOption.getDefault();
final String[] datePatternsList = localeOption.getDatePatternList();
this.datePatternsPE = PropertyEditorManager.findEditor(String[].class);
this.datePatternsPE.setValue( datePatternsList );
final String[] messagePatternsList = localeOption.getMessagePatternList();
this.messagePatternsPE = PropertyEditorManager.findEditor(String[].class);
this.messagePatternsPE.setValue( messagePatternsList );
final String[] numberPatternsList = localeOption.getNumberPatternList();
this.numberPatternsPE = PropertyEditorManager.findEditor(String[].class);
this.numberPatternsPE.setValue( numberPatternsList );
//---
this.datePatternsTextField.setText( this.datePatternsPE.getAsText() );
this.messagePatternsTextField.setText( this.messagePatternsPE.getAsText() );
this.numberPatternsTextField.setText( this.numberPatternsPE.getAsText() );
this.dateParseFormattedTextField.setValue( localeOption.getMessageArgDatePattern() );
this.numberParseFormattedTextField.setValue( localeOption.getMessageArgNumberPattern() );
}
Test6963811.java 文件源码
项目:jdk8u_jdk
阅读 17
收藏 0
点赞 0
评论 0
public void run() {
try {
Thread.sleep(this.time); // increase the chance of the deadlock
if (this.sync) {
synchronized (Test6963811.class) {
PropertyEditorManager.findEditor(Super.class);
}
}
else {
PropertyEditorManager.findEditor(Sub.class);
}
}
catch (Exception exception) {
exception.printStackTrace();
}
}
Test6963811.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 16
收藏 0
点赞 0
评论 0
public void run() {
try {
Thread.sleep(this.time); // increase the chance of the deadlock
if (this.sync) {
synchronized (Test6963811.class) {
PropertyEditorManager.findEditor(Super.class);
}
}
else {
PropertyEditorManager.findEditor(Sub.class);
}
}
catch (Exception exception) {
exception.printStackTrace();
}
}
IntrospectionSupport.java 文件源码
项目:aries-rsa
阅读 19
收藏 0
点赞 0
评论 0
private static Object convert(Object value, Class<?> type) {
if( type.isArray() ) {
if( value.getClass().isArray() ) {
int length = Array.getLength(value);
Class<?> componentType = type.getComponentType();
Object rc = Array.newInstance(componentType, length);
for (int i = 0; i < length; i++) {
Object o = Array.get(value, i);
Array.set(rc, i, convert(o, componentType));
}
return rc;
}
}
PropertyEditor editor = PropertyEditorManager.findEditor(type);
if (editor != null) {
editor.setAsText(value.toString());
return editor.getValue();
}
return null;
}
GenericObjectEditor.java 文件源码
项目:repo.kmeanspp.silhouette_score
阅读 20
收藏 0
点赞 0
评论 0
public static void registerEditor(String name, String value) {
Class<?> baseCls;
Class<?> cls;
try {
// array class?
if (name.endsWith("[]")) {
baseCls = Class.forName(name.substring(0, name.indexOf("[]")));
cls = Array.newInstance(baseCls, 1).getClass();
} else {
cls = Class.forName(name);
}
// register
PropertyEditorManager.registerEditor(cls, Class.forName(value));
} catch (Exception e) {
Logger.log(weka.core.logging.Logger.Level.WARNING, "Problem registering "
+ name + "/" + value + ": " + e);
}
}
IntrospectionSupport.java 文件源码
项目:Camel
阅读 17
收藏 0
点赞 0
评论 0
private static Object convert(TypeConverter typeConverter, Class<?> type, Object value)
throws URISyntaxException, NoTypeConversionAvailableException {
if (typeConverter != null) {
return typeConverter.mandatoryConvertTo(type, value);
}
if (type == URI.class) {
return new URI(value.toString());
}
PropertyEditor editor = PropertyEditorManager.findEditor(type);
if (editor != null) {
// property editor is not thread safe, so we need to lock
Object answer;
synchronized (LOCK) {
editor.setAsText(value.toString());
answer = editor.getValue();
}
return answer;
}
return null;
}
ObjectPropertyUtils.java 文件源码
项目:kc-rice
阅读 21
收藏 0
点赞 0
评论 0
/**
* Get a property editor given a property type.
*
* @param propertyType The property type to look up an editor for.
* @param path The property path, if applicable.
* @return property editor
*/
public static PropertyEditor getPropertyEditor(Class<?> propertyType) {
PropertyEditorRegistry registry = getPropertyEditorRegistry();
PropertyEditor editor = null;
if (registry != null) {
editor = registry.findCustomEditor(propertyType, null);
} else {
DataDictionaryService dataDictionaryService = KRADServiceLocatorWeb.getDataDictionaryService();
Map<Class<?>, String> editorMap = dataDictionaryService.getPropertyEditorMap();
String editorPrototypeName = editorMap == null ? null : editorMap.get(propertyType);
if (editorPrototypeName != null) {
editor = (PropertyEditor) dataDictionaryService.getDataDictionary().getDictionaryPrototype(editorPrototypeName);
}
}
if (editor == null && propertyType != null) {
// Fall back to default beans lookup
editor = PropertyEditorManager.findEditor(propertyType);
}
return editor;
}
JspRuntimeLibrary.java 文件源码
项目:packagedrone
阅读 26
收藏 0
点赞 0
评论 0
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()));
}
}
MMDCfgPanel.java 文件源码
项目:netbeans-mmd-plugin
阅读 16
收藏 0
点赞 0
评论 0
private void buttonFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonFontActionPerformed
final PropertyEditor editor = PropertyEditorManager.findEditor(Font.class);
if (editor == null) {
LOGGER.error("Can't find any font editor");
NbUtils.msgError(null, "Can't find editor! Unexpected state! Contact developer!");
return;
}
editor.setValue(this.config.getFont());
final DialogDescriptor descriptor = new DialogDescriptor(
editor.getCustomEditor(),
"Mind map font"
);
DialogDisplayer.getDefault().createDialog(descriptor).setVisible(true);
if (descriptor.getValue() == DialogDescriptor.OK_OPTION) {
this.config.setFont((Font) editor.getValue());
updateFontButton(this.config);
if (changeNotificationAllowed) {
this.controller.changed();
}
}
}
PropertyEditorProvider.java 文件源码
项目:eva2
阅读 17
收藏 0
点赞 0
评论 0
/**
* Retrieve an editor object for a given class.
* This method seems unable to retrieve a primitive editor for obscure reasons.
* So better use the one based on PropertyDescriptor if possible.
*/
public static PropertyEditor findEditor(Class<?> cls) {
PropertyEditor editor = PropertyEditorManager.findEditor(cls);
// Try to unwrap primitives
if (editor == null && Primitives.isWrapperType(cls)) {
editor = PropertyEditorManager.findEditor(Primitives.unwrap(cls));
}
if ((editor == null) && useDefaultGOE) {
if (cls.isArray()) {
Class<?> unwrapped = Primitives.isWrapperType(cls.getComponentType()) ? Primitives.unwrap(cls.getComponentType()) : cls;
if (unwrapped.isPrimitive()) {
editor = new ArrayEditor();
} else {
editor = new ObjectArrayEditor<>(unwrapped.getComponentType());
}
} else if (cls.isEnum()) {
editor = new EnumEditor();
} else {
editor = new GenericObjectEditor();
((GenericObjectEditor)editor).setClassType(cls);
}
}
return editor;
}
GenericObjectEditor.java 文件源码
项目:autoweka
阅读 21
收藏 0
点赞 0
评论 0
public static void registerEditor(String name, String value) {
Class baseCls;
Class cls;
try {
// array class?
if (name.endsWith("[]")) {
baseCls = Class.forName(name.substring(0, name.indexOf("[]")));
cls = Array.newInstance(baseCls, 1).getClass();
}
else {
cls = Class.forName(name);
}
// register
PropertyEditorManager.registerEditor(cls, Class.forName(value));
}
catch (Exception e) {
System.err.println("Problem registering " + name + "/" + value + ": " + e);
}
}
GenericObjectEditor.java 文件源码
项目:umple
阅读 17
收藏 0
点赞 0
评论 0
public static void registerEditor(String name, String value) {
Class<?> baseCls;
Class<?> cls;
try {
// array class?
if (name.endsWith("[]")) {
baseCls = Class.forName(name.substring(0, name.indexOf("[]")));
cls = Array.newInstance(baseCls, 1).getClass();
} else {
cls = Class.forName(name);
}
// register
PropertyEditorManager.registerEditor(cls, Class.forName(value));
} catch (Exception e) {
Logger.log(weka.core.logging.Logger.Level.WARNING, "Problem registering "
+ name + "/" + value + ": " + e);
}
}
IntrospectionSupport.java 文件源码
项目:daq-eclipse
阅读 19
收藏 0
点赞 0
评论 0
private static boolean isSettableType(Class clazz) {
if (PropertyEditorManager.findEditor(clazz) != null) {
return true;
}
if (clazz == URI.class) {
return true;
}
if (clazz == File.class) {
return true;
}
if (clazz == File[].class) {
return true;
}
if (clazz == Boolean.class) {
return true;
}
return false;
}
Test6963811.java 文件源码
项目:infobip-open-jdk-8
阅读 16
收藏 0
点赞 0
评论 0
public void run() {
try {
Thread.sleep(this.time); // increase the chance of the deadlock
if (this.sync) {
synchronized (Test6963811.class) {
PropertyEditorManager.findEditor(Super.class);
}
}
else {
PropertyEditorManager.findEditor(Sub.class);
}
}
catch (Exception exception) {
exception.printStackTrace();
}
}