org.hd.d.pg2k.webSvr.ads
Class EShirtAdBean

java.lang.Object
  extended by org.hd.d.pg2k.webSvr.ads.EShirtAdBean
All Implemented Interfaces:
AdBeanInterface

public final class EShirtAdBean
extends java.lang.Object
implements AdBeanInterface

This implements the e-shirt advertisement bean. This is mainly here as an example of how an AdBean might work; in general AdBean classes should be made available at run-time to the server(s) by being placed in their class-path or by some other mechanism.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.hd.d.pg2k.webSvr.ads.AdBeanInterface
AdBeanInterface.Context
 
Field Summary
private  java.lang.String overrideBodyText
          If non-null, overrides normal body text.
 
Constructor Summary
EShirtAdBean()
           
 
Method Summary
 boolean canMakeHTMLBodyInsert(AdBeanInterface.Context ctxt)
          Can make an HTML body-text insert in the given context.
 java.lang.String getHTMLBodyInsert(AdBeanInterface.Context ctxt, java.util.Random source)
          Make HTML body text in the given context, or null if none can be made.
 AdBeanInterface setParams(java.lang.String rawParams)
          Can be used to set general parameters for the bean, or can be null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

overrideBodyText

private java.lang.String overrideBodyText
If non-null, overrides normal body text. Accessed under the instance lock.

Constructor Detail

EShirtAdBean

public EShirtAdBean()
Method Detail

setParams

public AdBeanInterface setParams(java.lang.String rawParams)
Can be used to set general parameters for the bean, or can be null. If supplied and is non-null, this overrides the body copy supplied in the bean within the link, though we feel at liberty to trim whitespace.

Specified by:
setParams in interface AdBeanInterface
Returns:
instance so as to allow pure expression constructions of form (new ...Bean()).setParams().getHTMLBodyInsert(xxx, rnd)

canMakeHTMLBodyInsert

public boolean canMakeHTMLBodyInsert(AdBeanInterface.Context ctxt)
Can make an HTML body-text insert in the given context. We can only do this if the full exhibit name is passed to us and if the file is of a suitable type (a .jpg or a .gif) (so we will perform various simple checks).

Specified by:
canMakeHTMLBodyInsert in interface AdBeanInterface

getHTMLBodyInsert

public java.lang.String getHTMLBodyInsert(AdBeanInterface.Context ctxt,
                                          java.util.Random source)
Make HTML body text in the given context, or null if none can be made. This takes a random-number source and the user's locale and generates a segment of HTML to insert into a page.

We should not be called if the context is wrong, but we double-check and return "" if we know we can't generate a sensible HTML insert, else we blindly accept the exhibit name we are given in the context.

Specified by:
getHTMLBodyInsert in interface AdBeanInterface

DHD Multimedia Gallery V1.53.0

Copyright (c) 1996-2009, Damon Hart-Davis. All rights reserved.