myContent = createVelocityContainer("displayportrait");
myContent.contextPut("canLinkToHomePage", canLinkToHomePage ? Boolean.TRUE : Boolean.FALSE);
if (portraitIdent == null) throw new AssertException("identity can not be null!");
this.portraitIdent = portraitIdent;
ImageComponent ic = null;
GenderPropertyHandler genderHander = (GenderPropertyHandler) UserManager.getInstance().getUserPropertiesConfig().getPropertyHandler(UserConstants.GENDER);
String gender = "-"; // use as default
if (genderHander != null) {
gender = genderHander.getInternalValue(portraitIdent.getUser());
}
MediaResource portrait = null;
if (useLarge){
portrait = DisplayPortraitManager.getInstance().getPortrait(portraitIdent, DisplayPortraitManager.PORTRAIT_BIG_FILENAME);
if (gender.equals("-")) {
myContent.contextPut("portraitCssClass", DisplayPortraitManager.DUMMY_BIG_CSS_CLASS);
} else if (gender.equals("male")) {
myContent.contextPut("portraitCssClass", DisplayPortraitManager.DUMMY_MALE_BIG_CSS_CLASS);
} else if (gender.equals("female")) {
myContent.contextPut("portraitCssClass", DisplayPortraitManager.DUMMY_FEMALE_BIG_CSS_CLASS);
}
} else {
portrait = DisplayPortraitManager.getInstance().getPortrait(portraitIdent, DisplayPortraitManager.PORTRAIT_SMALL_FILENAME);
if (gender.equals("-")) {
myContent.contextPut("portraitCssClass", DisplayPortraitManager.DUMMY_SMALL_CSS_CLASS);
} else if (gender.equals("male")) {
myContent.contextPut("portraitCssClass", DisplayPortraitManager.DUMMY_MALE_SMALL_CSS_CLASS);
} else if (gender.equals("female")) {
myContent.contextPut("portraitCssClass", DisplayPortraitManager.DUMMY_FEMALE_SMALL_CSS_CLASS);
}
}
myContent.contextPut("hasPortrait", (portrait != null) ? Boolean.TRUE : Boolean.FALSE);
myContent.contextPut("identityKey", portraitIdent.getKey().toString());
if (portrait != null){
ic = new ImageComponent("image");
ic.setMediaResource(portrait);
myContent.put(ic);
}
putInitialPanel(myContent);
}