📄 eventinstance.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.Stack;
/**
* A storage class for events used by EventManagement.<br>
* Company: J2wap.com
* @author Julian Bright
* @version 1.1
*/
public class EventInstance
{
/** Event Instance Type */
private int c_intEventType;
/** Variable stack for Event Instance */
private Stack c_clsVariableStack;
/** URL associated with Event Instance */
private String c_strURL;
/**
* Event Instance constructor initialises local variables.
* @param in_intEventType For the particular event.
*/
public EventInstance(int in_intEventType)
{
c_intEventType = in_intEventType;
c_clsVariableStack = new Stack();
}
/**
* Constructor: This constructor is needed so that the "GoEventInstance"
* class will compile. It will create "c_clsVariableStack", hence it is
* the responsibility of the child class to set "intEventType".
*/
public EventInstance()
{
c_clsVariableStack = new Stack();
}
/**
* Returns the event type for the current instance
* @return One of the following event types:
* <ol>
* <li>Go - Preforms a Go on a URL
* <li>Prev - Returns to the last URL
* <li>Refresh - Refreshes the current URL
* <li>Noop - Doesn't perform any operation
* </ol>
*/
public int getEventType()
{
return c_intEventType;
}
/**
* Sets the URL for the go event.
* @param in_strURL The URL associated with this event instance.
*/
public void setURL(String in_strURL)
{
c_strURL = new String(in_strURL);
System.out.println("EventInstance::setURL => " + c_strURL);
}
/**
* Returns the URL for the operation.
* @return The URL associated with this event instance.
*/
public String getURL()
{
return c_strURL;
}
/**
* Adds a variable to the variable hashtable.
* @param in_strName The name of the new variable.
* @param in_strValue The value associated with the name.
*/
public void addVariable(String in_strName,
String in_strValue)
{
c_clsVariableStack.push(in_strValue);
c_clsVariableStack.push(in_strName);
}
/**
* Set all variables in the the referenced Browser Context stack.
* @param in_clsBrowserContext The browser context reference to variable stack.
*/
public void setVariablesInStack(BrowserContext in_clsBrowserContext)
{
String strName;
String strVal;
while (!c_clsVariableStack.empty())
{
strName = (String)c_clsVariableStack.pop();
strVal = (String)c_clsVariableStack.pop();
// Check the name and value for variable references.
if (strName.charAt(0) == '$')
strName = in_clsBrowserContext.getVariable(strName.substring(1));
if (strVal.charAt(0) == '$')
strVal = in_clsBrowserContext.getVariable(strVal.substring(1));
// Set the variable.
in_clsBrowserContext.setVariable(strName, strVal);
} // while
}
} // class EventInstance
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -