📄 eventmanagement.java
字号:
/*
* j2wap is distributed under the terms of the GNU Public License
*
* j2wap was written by:
*
* Scott Campbell
* Michael Nordling
* Karl Maftoum
* Julian Bright
*
* This was a final project for Comp.Engineering at the University of Canberra, Australia
*
* Now released as Open Source software. 28 November 2000
*
* Email: k_maftoum@hotmail.com for more info
*
* Use entirely at your own risk.
*/
package wae;
import java.util.Vector;
/**
* Event Management is used to manage the events from the UI, and layout engine.
*
* @author Julian Bright
* @version 1.1
*/
public class EventManagement
{
/** List of registered Event Instances */
private Vector c_clsEventInstances;
/** Number of Events Registered. Used to track the value of the next EventID */
private int c_intventCount;
/**
* Event Management constructor initialises the Event Instances.
*/
public EventManagement()
{
c_clsEventInstances = new Vector(3);
c_intventCount = 1;
}
/**
* Register a Go Event
* @param in_strURL The URL for go event. <i>(Pre-condition: URL != null)</i>
* @param in_bolSendReferer Boolean indicating whether to send the referer. (Not used)
* @param in_strMethod The method type (GET/POST)
* @param in_strEncType Determines the Encoding type for data retrived. (Not used)
* @return Newly Created EventID
*/
public int registerGo(String in_strURL,
boolean in_bolSendReferer,
String in_strMethod,
String in_strEncType)
{
GoEventInstance clsGoEvent = new GoEventInstance (1);
clsGoEvent.setAttributes( in_strURL, in_bolSendReferer,
in_strMethod, in_strEncType);
return addEventInstance(clsGoEvent);
}
/**
* Register a Prev Event.
* @return Newly Created EventID
*/
public int registerPrev()
{
EventInstance clsEventInstance = new EventInstance(2);
return addEventInstance(clsEventInstance);
}
/**
* Register a Refresh Event.
* @return Newly Created EventID
*/
public int registerRefresh()
{
EventInstance clsEventInstance = new EventInstance(3);
return addEventInstance(clsEventInstance);
}
/**
* Register a Noop Event.
* @return int Newly Created EventID
*/
public int registerNoop()
{
EventInstance clsEventInstance = new EventInstance(4);
return addEventInstance(clsEventInstance);
}
/**
* Set a variable for a go/prev event.
* @param in_intEventID EventID to assoicate variable to
* @param in_strName The name of the new variable.
* @param in_strValue The value associated with the name.
*/
public void setVariable(int in_intEventID,
String in_strName,
String in_strValue)
{
EventInstance clsEventInstance;
clsEventInstance = (EventInstance)c_clsEventInstances.elementAt(in_intEventID - 1);
clsEventInstance.addVariable(in_strName, in_strValue);
}
/**
* Set a postfield for a go event.
* <i>(Pre-condition: c_clsEventInstances.elementAt(in_intEventID - 1) must be a GoEventInstance object.)</i>
* @param: in_intEventID EventID to assoicate postfield with
* @param in_strName The name of the new postfield.
* @param in_strValue The value associated with the name.
*/
public void setPostfield(int in_intEventID,
String in_strName,
String in_strVal)
{
GoEventInstance clsGoEventInstance =
(GoEventInstance) c_clsEventInstances.elementAt(in_intEventID - 1);
clsGoEventInstance.addPostfield(in_strName, in_strVal);
} // setPostfield
/**
* Return a particular event instance.
* @param in_intEventID EventID to select
* @param in_clsBrowserContext Browser Context reference for updating variables
* @return EventInstance matching EventID
*/
public EventInstance getEventInstance(int in_intEventID,
BrowserContext in_clsBrowserContext)
{
EventInstance clsEventInstance;
clsEventInstance = (EventInstance)c_clsEventInstances.elementAt(in_intEventID - 1);
clsEventInstance.setVariablesInStack(in_clsBrowserContext);
return clsEventInstance;
}
/*
* Private function to add a new instance to the vetor
* Returns the new int index.
* @param in_clsEventInstance EventInstance object to add to list
* @return EventID of newly created instance.
*/
private int addEventInstance(EventInstance in_clsEventInstance)
{
c_clsEventInstances.addElement(in_clsEventInstance);
return c_intventCount++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -