Keiron Liddle wrote:

What is the convention behind UserAgent class? afaiu, the class should provide default values for all user-agent-related properties, which are overridable through the configuration file.

There could be two ways to set these values. From the command line we
want the config file to set values and when embedding they could extend
the user agent to set the values.
And what about the third one - set config file when embedding? That might be convenient too.

So, if I want to add auto values for page-height and page-width, how should I do it?

So an "auto" value should be determined by the user agent, right?
I think so. Spec says they should be "determined, in the case of continuous media, from the size of the User Agent window, otherwise from the size of the media." At least Antenna exposes these as user agent parameters.

Then just add the methods to the user agent.

Do you have any ideas of how to better specify the user agent config
data?
Well, I've been thinking about a kind of JavaBeans naming convention, when for each propery there is setter and getter and config file parser then could populate UserAgent through reflection API. But that might add unnecessary complexity + reflection is not so fast, so another alternative could be usual hash table and a propery getter may then check hashtable key first and if it's not exists return default value:
public int getAutoPageHeigh() {
String val;
if ( (val = (String)hashtable.get(AUTO_PAGE_HEIGHT_KEY)) != null)
return String.parseInt(val);
else
return DEFAULT_AUTO_PAGE_HEIGHT;
}
But actually number of UserAgent properties is pretty well limited and it's not going to extend, so its processing may be even less generic.

--
Oleg Tkachenko
eXperanto team
Multiconn Technologies, Israel


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to