Re: Please comment the Branding Link idea

2008-08-12 Thread jensiator

Last comment from me. If anyone is interessed. Wicket:link is not suitible to
use because then you cant use dynamic pageParameters. In my final version I
registert all branded pages during deployment. Adds them as a global to in a
HashMap in MyApplication class. Navlink only check if there is a registrated
brand of this target page. I have one brand/war so I always call it
*_override.class


public class NavLink extends PageLink
{
public NavLink(String s, Class pClass)
{
super(s, GetBrandedClass(pClass));
}

@SuppressWarnings({"unchecked"})
private static Class GetBrandedClass(Class
pClass)
{
MyApplication app = (MyApplication) Application.get();
if(app.getBranded().containsKey(pClass.getName()))
return app.getBranded().get(pClass.getName());

return pClass;
}
}
-- 
View this message in context: 
http://www.nabble.com/Branding-a-PageLink-target-Page-tp18382006p18939733.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Please comment the Branding Link idea

2008-07-30 Thread jensiator

This idea dont need a propertyfile! But I want to repeat that I'm using a jar
that the branded webapplication depends on. The jar is the core
functionallity that all brands depends on. As you see in the replace Im
keeping the package structure in the webapplication(on overrided
component/pages). Beside the WhateverName_brand.class I also have a
WhateverName_bran.html markupfile and css if it needed. I wonder if it might
be some memory/performance problem in this 'spike'. If the branded version
does not exist it will keep on throwing the exception. 

public class NavLink extends PageLink {
public NavLink(String s, Class pClass) {

super(s, GetBrandedClass(pClass));
}

private static Class GetBrandedClass(Class pClass) {
String simpleName = pClass.getSimpleName();
String name = pClass.getName().replace(simpleName, simpleName + "_"
+ Session.get().getStyle());

try {
return
Thread.currentThread().getContextClassLoader().loadClass(name);
} catch (ClassNotFoundException e) {
e.printStackTrace();  //Should be logged
}
return pClass; //returns the core version
}
}
I still need to try the wicket:link idea from above. Then you only brand the
markup file and change wicket:link. But I need to check out if absolute
paths in the markup will be nice. 


-- 
View this message in context: 
http://www.nabble.com/Branding-a-PageLink-target-Page-tp18382006p18735873.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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