}
languages.add(option);
}
Collections.sort(languages, new LanguagesComparator());
UIFormInputSet uiSettingSet = new UIFormInputSet("PortalSetting");
UIFormInputSet uiPropertiesSet = new UIFormInputSet("Properties");
uiSettingSet.addUIFormInput(new UIFormStringInput(FIELD_NAME, FIELD_NAME, null).addValidator(MandatoryValidator.class)
.addValidator(StringLengthValidator.class, 3, 30).addValidator(IdentifierValidator.class).setReadOnly(true));
uiSettingSet.addUIFormInput(new UIFormStringInput(FIELD_LABEL, FIELD_LABEL, null)
.addValidator(SpecialCharacterValidator.class));
uiSettingSet.addUIFormInput(new UIFormStringInput(FIELD_DESCRIPTION, FIELD_DESCRIPTION, null));
uiSettingSet.addUIFormInput(new UIFormSelectBox(FIELD_LOCALE, FIELD_LOCALE, languages)
.addValidator(MandatoryValidator.class));
List<SelectItemOption<String>> listSkin = new ArrayList<SelectItemOption<String>>();
SkinService skinService = getApplicationComponent(SkinService.class);
List<String> skinNames = new ArrayList<String>(skinService.getAvailableSkinNames());
Collections.sort(skinNames);
for (String skin : skinNames) {
SelectItemOption<String> skinOption = new SelectItemOption<String>(skin, skin);
listSkin.add(skinOption);
}
listSkin.get(0).setSelected(true);
UIFormSelectBox uiSelectBox = new UIFormSelectBox(FIELD_SKIN, FIELD_SKIN, listSkin);
uiSettingSet.addUIFormInput(uiSelectBox);
addUIFormInput(uiSettingSet);
// add to properties tab
List<SelectItemOption<String>> listSessionAlive = new ArrayList<SelectItemOption<String>>();
listSessionAlive.add(new SelectItemOption<String>(PortalProperties.SESSION_ALWAYS, PortalProperties.SESSION_ALWAYS));
listSessionAlive.add(new SelectItemOption<String>(PortalProperties.SESSION_ON_DEMAND,
PortalProperties.SESSION_ON_DEMAND));
listSessionAlive.add(new SelectItemOption<String>(PortalProperties.SESSION_NEVER, PortalProperties.SESSION_NEVER));
UIFormSelectBox uiSessionAliveBox = new UIFormSelectBox(FIELD_SESSION_ALIVE, FIELD_SESSION_ALIVE, listSessionAlive);
uiSessionAliveBox.setValue(PortalProperties.SESSION_ON_DEMAND);
uiPropertiesSet.addUIFormInput(uiSessionAliveBox);
// TODO add more box for showPortletMode and showWindowState if needed
UIFormCheckBoxInput<Boolean> uiShowInfobarBox = new UIFormCheckBoxInput<Boolean>(FIELD_SHOW_INFOBAR,
FIELD_SHOW_INFOBAR, true);
uiShowInfobarBox.setOnChange("CheckShowInfobar");
uiPropertiesSet.addChild(uiShowInfobarBox);
UIFormStringInput uiViewportInput = new UIFormStringInput(FIELD_VIEWPORT, FIELD_VIEWPORT, null);
uiViewportInput.setReadOnly(false);
uiPropertiesSet.addChild(uiViewportInput);
addUIFormInput(uiPropertiesSet);
List<SelectItemOption<String>> listSharedLayout = new ArrayList<SelectItemOption<String>>();
listSharedLayout.add(new SelectItemOption<String>(PortalProperties.SHARED_LAYOUT_ALL, PortalProperties.SHARED_LAYOUT_ALL));
listSharedLayout.add(new SelectItemOption<String>(PortalProperties.SHARED_LAYOUT_ADMINS, PortalProperties.SHARED_LAYOUT_ADMINS));
UIFormSelectBox sharedLayoutSelectBox = new UIFormSelectBox(FIELD_SHARED_LAYOUT, FIELD_SHARED_LAYOUT, listSharedLayout);
sharedLayoutSelectBox.setValue(PortalProperties.SHARED_LAYOUT_ALL);
uiPropertiesSet.addUIFormInput(sharedLayoutSelectBox);
UIFormInputSet uiPermissionSetting = createUIComponent(UIFormInputSet.class, "PermissionSetting", null);
addUIComponentInput(uiPermissionSetting);
UIListPermissionSelector uiListPermissionSelector = createUIComponent(UIListPermissionSelector.class, null, null);
uiListPermissionSelector.configure(WebuiRequestContext.generateUUID("UIListPermissionSelector"), "accessPermissions");
uiListPermissionSelector.addValidator(EmptyIteratorValidator.class);
uiPermissionSetting.addChild(uiListPermissionSelector);
uiPermissionSetting.setSelectedComponent(uiListPermissionSelector.getId());
UIPermissionSelector uiEditPermission = createUIComponent(UIPermissionSelector.class, null, null);
uiEditPermission.setRendered(false);
uiEditPermission.addValidator(org.exoplatform.webui.organization.UIPermissionSelector.MandatoryValidator.class);
uiEditPermission.configure("UIPermissionSelector", "editPermission");
uiPermissionSetting.addChild(uiEditPermission);
}