Hi Sudipto,

Sorry - I dropped this one - I meant to reply to you earlier.

But you have already done what I had to do, albeit slightly differently. I 
wrote my own logon servlet and controller servlet by extending 
LogonServlet and ControllerServlet, respectively, and specifying them 
in the web.xml file (, editting "<servlet-name>Logon</servlet-name>" 
and "<servlet-name>Controller</servlet-name>", respectively).

I also had to make minor mods to, I think, the getters:

    @Override
    protected WebController getWebController(PathBuilder pathBuilder) 
{
        return new SaipWebController(pathBuilder);
    }

    // //////////////////////////////////////////////////////////////////
    // doGet, doPost
    // //////////////////////////////////////////////////////////////////

    @Override
    protected HtmlComponentFactory getHtmlComponentFactory() {
        return new SaipHtmlComponentFactory(getPathBuilder());
    }


I have not committed those changes, it seems.


In the "SaipHtmlComponentFactory", I could provide any of my own 
components, as required:

    @Override
    public LogonFormPage createLogonPage(final String user, final String 
password, boolean registerLink, String error) {
        return new SaipLogonFormPage(pathBuilder, styleSheet, header, footer, 
user, password, registerLink, error);
    }

    @Override
    public Component createInlineBlock(String style, String text, String 
description) {
        return new SaipSpan(style, text, description, false);
    }

    public Component createSaipBlock(String style, String text, String 
description) {
        return new SaipSpan(style, text, description, true);
    }

    public Component createFile(String style, String description, String 
fileName) {
        return new SaipFileHtml(style, description, fileName);
    }


Where Saip* are my custom classes.


Regards,
Kevin


On 17 May 2012 at 16:02, Sudipto Majumder wrote:

> Hi Dan,
> 
> Since I got some time I was looking at ways to customize the HTML viewer
> UI. Say, I want to change the login page. Here is what I did.
> 
> I changed the access modifier of the method *renderPrompt() *of the class *
> org.apache.isis.viewer.html.servlet.LogonServlet* from *private* to *
> protected*, extended that servlet and introduced my own servlet overriding
> the *renderPrompt()* method and made change in the *web.xml* accordingly to
> point to my servlet for the url pattern */logon.htmlviewer*.
> 
> I also made my own login form by extending the class *
> org.apache.isis.viewer.html.component.html.LogonFormPage* and overriding
> the *writeContent()* method and used this class inside the
> *renderPrompt() *method
> mentioned earlier.
> 
> Further I needed some *public* getter methods for the attributes *user,
> password, registerLink, error* in class
> *org.apache.isis.viewer.html.component.html.LogonFormPage
> *and *pathBuilder, styleSheet, siteHeader, siteFooter* in class *
> org.apache.isis.viewer.html.component.html.AbstractHtmlPage*.
> 
> The logic I have not changed anything but only the html part inside
> the *writeContent()
> *method and my purpose was solved.
> 
> The point I am trying to make is that if you provide some public getter
> methods in many of your framework classes encapsulating the private
> attributes and make some of the methods less restrictive (at least
> protected would do), then it will be much easier to extend your framework
> code and make UI customizations. Please let me know your thought on the
> same.
> 
> Thanks,
> Sudipto.
> 
> 
> On Thu, May 10, 2012 at 5:49 PM, Dan Haywood
> <[email protected]>wrote:
> 
> > Hi Sudipto
> > that's great to hear.
> >
> > Of course, as I'm sure you're aware, the JQM is incomplete - there is still
> > no support for invoking actions, for example.  Feel free to pick it up and
> > add that functionality if you wish.
> >
> > By the way, the JQM will break once I get back to the JSON viewer and
> > update it to the latest version of the Restful Objects spec [1].  Just so
> > you are aware...  However,  the JQM code is currently quite small, so
> > updating it shouldn't be too difficult.
> >
> > Cheers
> > Dan
> >
> > [1] http://restfulobjects.org
> >

Reply via email to