|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.xml.tree.nodes; import javax.xml.parsers.*; import org.xml.sax.*; import org.xml.sax.helpers.*; import org.w3c.dom.*; import java.lang.reflect.*; import org.openide.ErrorManager; /** * This class encapsulates bean properties of ElementNode which may * be overridden by modules wishing to handle particular doctypes. * * @author Rich Unger * @version 0.1 */ public class ElementInfo { public ElementInfo() {} public ElementCustomizer getCustomizer() { if( m_customizerClass == null ) { return null; } try { Object bean = m_customizerClass.newInstance(); for( int i=0; i < m_propertyList.getLength(); i++ ) { // iterate through the bean properties Element propertyElement = (Element)m_propertyList.item(i); String sKey = propertyElement.getAttribute("name"); // NOI18N String sVal = propertyElement.getAttribute("value"); // NOI18N WriterCache.MethodAndType mat = WriterCache.getWriterMethodAndType( m_customizerClass, sKey ); // no need to worry about the 'type' part of MethodAndType // as we only support strings from the xml file Method method = mat.getMethod(); Object[] args = { sVal }; method.invoke(bean, args); } return (ElementCustomizer)bean; } catch( Exception ex ) { ErrorManager.getDefault().notify(ex); return null; } } public void setCustomizerClass( Class clazz, NodeList propertyList ) { m_customizerClass = clazz; m_propertyList = propertyList; } public String getIconBase() { return m_sIconBase; } public void setIconBase( String s ) { m_sIconBase = s; } public String getText() { return m_sText; } public void setText( String s ) { m_sText = s; } protected Class m_customizerClass; /** The bean properties for the customizer */ protected NodeList m_propertyList; protected String m_sIconBase; protected String m_sText; } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.