Thanks Lance, but not quite what I'm after. It's only given new lines but no indentation (which I presume will disappear in production mode) It's made my code look a bit ugly. Maybe I should look at a .tml file set up.
writer.element("div", "class", "userbackground"); writer.writeRaw(NEWLINE); writer.element("div","id",currentPhone.getNumber(), "class","user"); writer.writeRaw(NEWLINE); writer.element("div","class","infoline1"); writer.writeRaw(NEWLINE); writer.element("div","class","name"); writer.writeRaw(NEWLINE); writer.write(currentPhone.getName() + " " + currentPhone.getNumber()); writer.writeRaw(NEWLINE); writer.end(); writer.writeRaw(NEWLINE); writer.end(); writer.writeRaw(NEWLINE); writer.element("div","class","infoline2"); writer.writeRaw(NEWLINE); writer.element("div","class","voicemail"); writer.writeRaw(NEWLINE); writer.element("img","src","email.png"); writer.end(); writer.writeRaw(NEWLINE); writer.end(); writer.writeRaw(NEWLINE); writer.end(); writer.writeRaw(NEWLINE); writer.element("div", "class","currentcall currentcallplaceholder"); writer.writeRaw(" "); writer.end(); writer.writeRaw(NEWLINE); writer.end(); writer.writeRaw(NEWLINE); writer.end(); writer.writeRaw(NEWLINE); writer.element("div","class","spacer"); writer.writeRaw(NEWLINE); writer.end(); Because I don't have the luxury of having a web designer pass me a template, what happens in this case. You're given a shit-hot template from the designer - you just put it into .tml fragments to go along with the component? On 03/04/2012, at 7:34 PM, Lance Java wrote: > This should work: > > private static final String NEWLINE = System.getProperty("line.separator"); > ... > > writer.element("div", "class", "userbackground"); > writer.writeRaw(NEWLINE); > writer.element("div","id",currentPhone.getNumber(), "class","user"); > ... > > On Tuesday, 3 April 2012, Chris Mylonas <ch...@opencsta.org> wrote: >> Hi Tap List, >> >> >> I've got production mode set to false and the parts of the html document > that I haven't created come out quite nicely. >> The parts I have rendered in my component (below) are coming out on one > line. It's the eye-sore of the document!! >> >> How do I fix this? >> >> >> I'm also wondering what the advantages are of using code to generate the > html if I've already built the template in html? >> This >> >> writer.element("div", "class", "userbackground"); >> writer.element("div","id",currentPhone.getNumber(), > "class","user"); >> writer.element("div","class","infoline1"); >> writer.element("div","class","name"); >> writer.write(currentPhone.getName() + " " + > currentPhone.getNumber()); >> writer.end(); >> writer.end(); >> writer.element("div","class","infoline2"); >> writer.element("div","class","voicemail"); >> writer.element("img","src","email.png"); >> writer.end(); >> writer.end(); >> writer.end(); >> writer.element("div", "class","currentcall > currentcallplaceholder"); >> writer.writeRaw(" "); >> writer.end(); >> writer.end(); >> writer.end(); >> writer.element("div","class","spacer"); >> writer.end(); >> >> VS >> this >> >> writer.writeRaw("" + >> "<div class=\"userbackground\">" + >> "<div id=\"" + currentPhone.getNumber() + "\" class=\"user\">" + >> "<div class=\"infoline1\">" + >> "<div class=\"name\">" + currentPhone.getName() + " " + > currentPhone.getNumber() + "</div>" + >> "</div>" + >> "<div class=\"infoline2\">" + >> "<div class=\"voicemail\"><img src=\"email.png\" /></div>" + >> "</div>" + >> "<div class=\"currentcall currentcallplaceholder\"> " + >> "</div>" + >> "</div>" + >> "</div>" + >> "<div class=\"spacer\">" + >> "</div>"); >> >> >> >> It's just a copy paste, run over it with some backslashes where I need to. >> >> Cheers >> Chris