⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bean.java

📁 使用方法: 实例程序的运行: 每个实例下都有本实例的.xml文件或.html文件或.xsl文件
💻 JAVA
字号:
/*
    Copyright (c) 1999 Bruce Martin, a contributor to the Xbean project.
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to
    deal in the Software without restriction, including without limitation the
    rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
    sell copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

        The above copyright notice and this permission notice shall be included
        in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    DEALINGS IN THE SOFTWARE.
*/


package org.xbeans.sample;

/*
     This is an example of an Xbean.  It is a good starting point for developing
     Xbeans.  Notice that this sample Xbean is both a source and a sink of data.
     That is, this Xbean supports both the DOMListener and the DOMSource interfaces.
     It simply passes on the Document to it's listener.
*/

// Import org.xbeans.* for definitions of common interfaces.
import org.xbeans.*;

// The DOM definition from w3c
import org.w3c.dom.Document;

/*
    Implement a class that implements DOMListener and or DOMSource
    Add Java Bean style properties, methods, property editors and customizers
    as required by your Xbean.
*/

public class Bean implements DOMListener, DOMSource {

    public Bean() {
    }

    private DOMListener DOMListener;

    // The next 2 methods implement operations in the DomSource interface.

    // Sets the listener of DOM events, i.e. the next Xbean on the chain.
    public void setDOMListener(DOMListener newDomListener) {
        DOMListener = newDomListener;
    }

    // Returns the listener of DOM events.
    public DOMListener getDOMListener(){
        return DOMListener;
    }

    /*
        The following method implements the DomListener interface.
        This is where code that processes the DOM goes.  (In this sample
        bean no processing is done.) Once the processing
        is complete, the method calls the next Xbean.
    */

    public void documentReady(DOMEvent evt) throws XbeansException {
        if (DOMListener==null) {
            throw new XbeansException(
                        evt.getDocument().getNodeName(),
                        "sampleBean",
                        "next component not established",
                        "The component needs to be configured."
                        );
        }

        // Code to process the incoming DOM document goes here

        // Pass the document on to the next Xbean.  It is required that all
        // source Xbeans call the next Xbean.
        DOMListener.documentReady(evt);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -