If anyone wants to follow up on this, please contact him directly...

Thanks,

-jon

------ Forwarded Message
From: "Tony Barrile" <[EMAIL PROTECTED]>
Date: Tue, 17 Jul 2001 20:20:53 -0400
To: <[EMAIL PROTECTED]>
Subject: FW: ECS suggestion

Jon, I would like to submit a suggestion to you regarding the
ConcreteElement class in ECS.
Basically, it would be nice if ConcreteElement had an overriden method for
output(OutputStream), something like

public static void output(OutputStream os, ConcreteElement ce){
.....
}

The reason I make this suggestion is that I am extending various parts of
the API for image-based menus(nav-bars).  They are basically contained in a
smart-bean that does some state-toggling.  If I want to use the toString
method, I presently need to duplicate code in a few places, and it would be
more advantageous to my application if there was a static output method in
this class.


Here is sample code for what I am doing, so you can see where how it is
useful:

/*note: extending A */

public void output(OutputStream out) {
  A tempAnchor = (A) super.clone();
  IMG image = (IMG) mImageElement.clone();
  if (this.getState().equals(MenuItemState.DOWN)) {
   image.addAttribute(ON_LOAD, msOnLoad);
  }
  tempAnchor.addElement(image);

  /*the following can be replaced by:
ConcreteElement.output(out,tempAnchor);*/

  String encoding = null;
        if ( getCodeSet() != null ){
           encoding = getCodeSet();
        } else {
           encoding = "UTF-16BE";
        }
  boolean prettyPrint = this.getPrettyPrint();
        try{
   out.write(createStartTag().getBytes(encoding));

            Enumeration enum = tempAnchor.keys();
   while(enum.hasMoreElements()){
    Object obj = tempAnchor.getElement((String)enum.nextElement());
    if(obj instanceof GenericElement){
     Element e = (Element)obj;
     if (prettyPrint && this instanceof Printable)

                     if ( getNeedLineBreak() ) {
          out.write('\n');
          e.setTabLevel(tabLevel + 1);
                        }
     }
     e.output(out);
    }else{
     if (prettyPrint && this instanceof Printable){
                     if ( getNeedLineBreak() ){
                         out.write('\n');
       putTabs(tabLevel + 1, out);
                        }
     }
     String string = obj.toString();
     out.write(string.getBytes());
    }
   }
      out.write(createEndTag().getBytes());

        }catch (UnsupportedEncodingException uee){
            uee.printStackTrace(new PrintWriter(out));
  }catch(IOException ioe) {
            ioe.printStackTrace(new PrintWriter(out));
        }
 }
*******************************************************************

If you would like to discuss via ICQ, 69457433 is my work-ICQ#

Tony Barrile



14901 Bogle Drive, Suite 104
Chantilly, VA 20151

t (703) 929-4810
f (703) 995-0783
[EMAIL PROTECTED]
http://www.altum.com

------ End of Forwarded Message


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

Reply via email to