private static final String FIELD_PORTLET_PREF = "PortletPref";
@SuppressWarnings("unchecked")
public UIPortletForm() throws Exception {
super("UIPortletForm");
UIFormInputSet uiPortletPrefSet = new UIFormInputSet(FIELD_PORTLET_PREF).setRendered(false);
addUIFormInput(uiPortletPrefSet);
UIFormInputSet uiSettingSet = new UIFormInputSet("PortletSetting");
uiSettingSet
.addUIFormInput(new UIFormInputInfo("displayName", "displayName", null))
.addUIFormInput(
new UIFormStringInput("title", "title", null).addValidator(StringLengthValidator.class, 3, 60)
.addValidator(NotHTMLTagValidator.class, "UIPortletForm.msg.InvalidPortletTitle"))
.addUIFormInput(
new UIFormStringInput("width", "width", null).addValidator(ExpressionValidator.class,
"(^([1-9]\\d*)(?:px)?$)?", "UIPortletForm.msg.InvalidWidthHeight"))
.addUIFormInput(
new UIFormStringInput("height", "height", null).addValidator(ExpressionValidator.class,
"(^([1-9]\\d*)(?:px)?$)?", "UIPortletForm.msg.InvalidWidthHeight"))
.addUIFormInput(new UICheckBoxInput("showInfoBar", "showInfoBar", false))
.addUIFormInput(new UICheckBoxInput("showPortletMode", "showPortletMode", false))
.addUIFormInput(new UICheckBoxInput("showWindowState", "showWindowState", false))
.addUIFormInput(
new UIFormTextAreaInput("description", "description", null).addValidator(NotHTMLTagValidator.class,
"UIPortletForm.msg.InvalidPortletDescription"));
addUIFormInput(uiSettingSet);
UIFormInputIconSelector uiIconSelector = new UIFormInputIconSelector("Icon", "icon");
addUIFormInput(uiIconSelector);
UIFormInputThemeSelector uiThemeSelector = new UIFormInputThemeSelector(FIELD_THEME, null);
SkinService skinService = getApplicationComponent(SkinService.class);
uiThemeSelector.getChild(UIItemThemeSelector.class).setValues(skinService.getPortletThemes());
addUIFormInput(uiThemeSelector);
PortalRequestContext prc = Util.getPortalRequestContext();
if (prc.getSiteType() != SiteType.USER) {
UIListPermissionSelector uiListPermissionSelector = createUIComponent(UIListPermissionSelector.class, null, null);
uiListPermissionSelector.configure(WebuiRequestContext.generateUUID("UIListPermissionSelector"), "accessPermissions");
uiListPermissionSelector.addValidator(EmptyIteratorValidator.class);
UIFormInputSet uiPermissionSet = createUIComponent(UIFormInputSet.class, "PortletPermission", null);
uiPermissionSet.addChild(uiListPermissionSelector);
addUIFormInput(uiPermissionSet);
}
}