brcomponentevent.java

来自「java调用ie浏览器demo源码,可以用在windows或者linux」· Java 代码 · 共 133 行

JAVA
133
字号
/*
 * Copyright (C) 2008 Sun Microsystems, Inc. All rights reserved. Use is
 * subject to license terms.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the Lesser GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA.
 */

package org.jdic.web.event;

import java.awt.Component;
import java.awt.event.ComponentEvent;


/**
 * An event which indicates that a browser finished the document loading, 
 * wants to navigate by refference, changes the title or something else.
 * 
 * This event is generated by a browser object. 
 *
 * @author uta
 */            
public class BrComponentEvent extends ComponentEvent {
    /**
     * DISPID_XXXX constats from MSDN
     */
    public static final int DISPID_BEFORENAVIGATE     =100;   // this is sent before navigation to give a chance to abort
    public static final int DISPID_NAVIGATECOMPLETE   =101;   // in async, this is sent when we have enough to show
    public static final int DISPID_STATUSTEXTCHANGE   =102;
    public static final int DISPID_QUIT               =103;
    public static final int DISPID_DOWNLOADCOMPLETE   =104;
    public static final int DISPID_COMMANDSTATECHANGE =105;
    public static final int DISPID_DOWNLOADBEGIN      =106;
    public static final int DISPID_NEWWINDOW          =107;   // sent when a new window should be created
    public static final int DISPID_PROGRESSCHANGE     =108;   // sent when download progress is updated
    public static final int DISPID_WINDOWMOVE         =109;   // sent when main window has been moved
    public static final int DISPID_WINDOWRESIZE       =110;   // sent when main window has been sized
    public static final int DISPID_WINDOWACTIVATE     =111;   // sent when main window has been activated
    public static final int DISPID_PROPERTYCHANGE     =112;   // sent when the PutProperty method is called
    public static final int DISPID_TITLECHANGE        =113;   // sent when the document title changes
    public static final int DISPID_TITLEICONCHANGE    =114;   // sent when the top level window icon may have changed.
    public static final int DISPID_FRAMEBEFORENAVIGATE = 200;//frameBeforeNavigate
    public static final int DISPID_FRAMENAVIGATECOMPLETE = 201;//frameNavigateComplete
    public static final int DISPID_FRAMENEWWINDOW = 204;//frameNewWindow

    public static final int DISPID_BEFORENAVIGATE2               = 250;//beforeNavigate2")},// hyperlink clicked on
    public static final int DISPID_NEWWINDOW2                    = 251;//newWindow2")},
    public static final int DISPID_NAVIGATECOMPLETE2             = 252;//navigateComplete2")},// UIActivate new document
    public static final int DISPID_ONQUIT                        = 253;//onQuit")},
    public static final int DISPID_ONVISIBLE                     = 254;//onVisible")},// sent when the window goes visible/hidden
    public static final int DISPID_ONTOOLBAR                     = 255;//onToolbar")},// sent when the toolbar should be shown/hidden
    public static final int DISPID_ONMENUBAR                     = 256;//ONMENUBAR")},// sent when the menubar should be shown/hidden
    public static final int DISPID_ONSTATUSBAR                   = 257;//ONSTATUSBAR")},// sent when the statusbar should be shown/hidden
    public static final int DISPID_ONFULLSCREEN                  = 258;//ONFULLSCREEN")},// sent when kiosk mode should be on/off
    public static final int DISPID_DOCUMENTCOMPLETE              = 259;//DOCUMENTCOMPLETE")},// new document goes ReadyState_Complete
    public static final int DISPID_ONTHEATERMODE                 = 260;//ONTHEATERMODE")},// sent when theater mode should be on/off
    public static final int DISPID_ONADDRESSBAR                  = 261;//ONADDRESSBAR")},// sent when the address bar should be shown/hidden
    public static final int DISPID_WINDOWSETRESIZABLE            = 262;//WINDOWSETRESIZABLE")},// sent to set the style of the host window frame
    public static final int DISPID_WINDOWCLOSING                 = 263;//WINDOWCLOSING")},// sent before script window.close closes the window
    public static final int DISPID_WINDOWSETLEFT                 = 264;//WINDOWSETLEFT")},// sent when the put_left method is called on the WebOC
    public static final int DISPID_WINDOWSETTOP                  = 264;//WINDOWSETTOP")},// sent when the put_top method is called on the WebOC
    public static final int DISPID_WINDOWSETWIDTH                = 266;//WINDOWSETWIDTH")},// sent when the put_width method is called on the WebOC
    public static final int DISPID_WINDOWSETHEIGHT               = 267;//WINDOWSETHEIGHT")},// sent when the put_height method is called on the WebOC
    public static final int DISPID_CLIENTTOHOSTWINDOW            = 268;//CLIENTTOHOSTWINDOW")},// sent during window.open to request conversion of dimensions
    public static final int DISPID_SETSECURELOCKICON             = 269;//SETSECURELOCKICON")},// sent to suggest the appropriate security icon to show
    public static final int DISPID_FILEDOWNLOAD                  = 270;//FILEDOWNLOAD")},// Fired to indicate the File Download dialog is opening
    public static final int DISPID_NAVIGATEERROR                 = 271;//NAVIGATEERROR")},// Fired to indicate the a binding error has occured
    public static final int DISPID_PRIVACYIMPACTEDSTATECHANGE    = 272;//PRIVACYIMPACTEDSTATECHANGE")},// Fired when the user's browsing experience is impacted
// Printing events
    public static final int DISPID_PRINTTEMPLATEINSTANTIATION    = 225;//PRINTTEMPLATEINSTANTIATION")},// Fired to indicate that a print template is instantiated
    public static final int DISPID_PRINTTEMPLATETEARDOWN         = 226;//PRINTTEMPLATETEARDOWN")},// Fired to indicate that a print templete is completely gone
    public static final int DISPID_UPDATEPAGESTATUS              = 227;//UPDATEPAGESTATUS")},// Fired to indicate that the spooling status has changed
//staff
    public static final int DISPID_ONFOCUCHANGE = -1;
    public static final int DISPID_ONFOCUSMOVE = -2;
    public static final int DISPID_REFRESH = -3;
    
     private final String stName;
     private final String stValue;


    /**
     * Constructor for <code>BrComponentEvent</code>
     * @param source the source browser component
     * @param id the unique event identifier (DISPID_XXXX constant)
     * @param stName the event name (optional)
     * @param stValue the event parameter (optional)
     */
    public BrComponentEvent(
            Component source, 
            int id, 
            String stName, 
            String stValue) 
    {
        super(source, id);
        this.stName = stName;
        this.stValue = stValue;
    }
    
    /**
     * Getter for <code>Name</code> property.
     * @return the event name
     */
    public String getName() { return stName; }
    
    /**
     * Getter for <code>Value</code> property.
     * @return the event parameter
     */
    public String getValue() { return stValue; }

    /**
     * Returns a string representation of the value.
     * @return the text of a Java language annotation value expression whose value is the value of this element.
     */
    @Override
    public String toString(){
        return "id:" + getID() + " Name:" + stName + " Value:" + stValue;  
    }
}

⌨️ 快捷键说明

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