public UICategoryForm() throws Exception { isDoubleClickSubmit = false; UIFormInputWithActions detailTab = new UIFormInputWithActions(CATEGORY_DETAIL_TAB); UIFormStringInput categoryTitle = new UIFormStringInput(FIELD_CATEGORYTITLE_INPUT, FIELD_CATEGORYTITLE_INPUT, null); categoryTitle.addValidator(MandatoryValidator.class); UIFormStringInput categoryOrder = new UIFormStringInput(FIELD_CATEGORYORDER_INPUT, FIELD_CATEGORYORDER_INPUT, "0"); categoryOrder.addValidator(PositiveNumberFormatValidator.class); UIFormTextAreaInput description = new UIFormTextAreaInput(FIELD_DESCRIPTION_INPUT, FIELD_DESCRIPTION_INPUT, null); UIFormTextAreaInput userPrivate = new UIFormTextAreaInput(FIELD_USERPRIVATE_MULTIVALUE, FIELD_USERPRIVATE_MULTIVALUE, null); detailTab.addUIFormInput(categoryTitle); detailTab.addUIFormInput(categoryOrder); detailTab.addUIFormInput(userPrivate); detailTab.addUIFormInput(description); String[] strings = new String[] {"SelectUser", "SelectMemberShip", "SelectGroup"}; String[] icons = ForumUtils.getClassIconWithAction(); List<ActionData> actions = new ArrayList<ActionData>(); ActionData ad; int i = 0; for (String string : strings) { ad = new ActionData(); if (i == 0) ad.setActionListener("AddValuesUser"); else ad.setActionListener("AddPrivate"); ad.setActionParameter(String.valueOf(i) + ForumUtils.COMMA + FIELD_USERPRIVATE_MULTIVALUE); ad.setCssIconClass(icons[i]); ad.setActionName(string); actions.add(ad); ++i; } detailTab.setActionField(FIELD_USERPRIVATE_MULTIVALUE, actions); addUIFormInput(detailTab); UIPermissionPanel permissionPanel = createUIComponent(UIPermissionPanel.class, null, PERMISSION_TAB); permissionPanel.setPermission(null, new String[] {MODERAROR, TOPICABLE, POSTABLE, VIEWER}); addChild(permissionPanel); setActions(new String[] {"Save", "Cancel"}); setAddColonInLabel(true); }
public void setValues(final UIPortlet uiPortlet) throws Exception { uiPortlet_ = uiPortlet; invokeGetBindingBean(uiPortlet_); String icon = uiPortlet.getIcon(); if (icon == null || icon.length() < 0) { icon = "PortletIcon"; } getChild(UIFormInputIconSelector.class).setSelectedIcon(icon); getChild(UIFormInputThemeSelector.class) .getChild(UIItemThemeSelector.class) .setSelectedTheme(uiPortlet.getSuitedTheme(null)); if (hasEditMode()) { uiPortlet.setCurrentPortletMode(PortletMode.EDIT); } else { Map<String, String> portletPreferenceMaps = new HashMap<String, String>(); org.gatein.pc.api.Portlet portlet = uiPortlet.getProducedOfferedPortlet(); Set<String> keySet = portlet.getInfo().getPreferences().getKeys(); for (String key : keySet) { PreferenceInfo preferenceInfo = portlet.getInfo().getPreferences().getPreference(key); if (!preferenceInfo.isReadOnly()) { String ppValue = (preferenceInfo.getDefaultValue().size() > 0) ? preferenceInfo.getDefaultValue().get(0) : ""; portletPreferenceMaps.put(key, ppValue); } } Portlet pp = uiPortlet.getPreferences(); if (pp != null) { for (Preference pref : pp) { if (!pref.isReadOnly()) { portletPreferenceMaps.put( pref.getName(), (pref.getValues().size() > 0) ? pref.getValues().get(0) : ""); } } } if (portletPreferenceMaps.size() > 0) { Set<String> ppKeySet = portletPreferenceMaps.keySet(); UIFormInputSet uiPortletPrefSet = getChildById(FIELD_PORTLET_PREF); uiPortletPrefSet.getChildren().clear(); for (String ppKey : ppKeySet) { String ppValue = portletPreferenceMaps.get(ppKey); UIFormStringInput preferenceStringInput = new UIFormStringInput(ppKey, null, ppValue); preferenceStringInput.setLabel(ppKey); preferenceStringInput.addValidator(MandatoryValidator.class); uiPortletPrefSet.addUIFormInput(preferenceStringInput); } uiPortletPrefSet.setRendered(true); setSelectedTab(FIELD_PORTLET_PREF); return; } setSelectedTab("PortletSetting"); } }
public UIPostForm() throws Exception { if (ForumUtils.isEmpty(getId())) setId("UIPostForm"); isDoubleClickSubmit = false; UIFormStringInput postTitle = new UIFormStringInput(FIELD_POSTTITLE_INPUT, FIELD_POSTTITLE_INPUT, null); postTitle.addValidator(MandatoryValidator.class); UIFormStringInput editReason = new UIFormStringInput(FIELD_EDITREASON_INPUT, FIELD_EDITREASON_INPUT, null); editReason.setRendered(false); UIForumInputWithActions threadContent = new UIForumInputWithActions(FIELD_THREADCONTEN_TAB); UIFormWYSIWYGInput formWYSIWYGInput = new UIFormWYSIWYGInput(FIELD_MESSAGECONTENT, FIELD_MESSAGECONTENT, ForumUtils.EMPTY_STR); formWYSIWYGInput.addValidator(MandatoryValidator.class); formWYSIWYGInput.setToolBarName("Basic"); formWYSIWYGInput.setWidth("92%"); formWYSIWYGInput.setFCKConfig(WebUIUtils.getFCKConfig()); threadContent.addChild(postTitle); threadContent.addChild(editReason); threadContent.addChild(formWYSIWYGInput); threadContent.addUIFormInput(new UIFormInputInfo(FIELD_ATTACHMENTS, FIELD_ATTACHMENTS, null)); threadContent.setActionField(FIELD_THREADCONTEN_TAB, getUploadFileList()); threadContent.setActionIdAddItem(FIELD_ATTACHMENTS); threadContent.setActionAddItem("Attachment"); threadContent.setLabelActionAddItem(getLabel("Attachment")); addUIFormInput(threadContent); this.setActions(new String[] {"SubmitPost", "PreviewPost", "Cancel"}); setAddColonInLabel(true); }
public UIDriveInputSet(String name) throws Exception { super(name); setComponentConfig(getClass(), null); addUIFormInput( new UIFormStringInput(FIELD_NAME, FIELD_NAME, null) .addValidator(MandatoryValidator.class) .addValidator(ECMNameValidator.class)); addUIFormInput(new UIFormSelectBox(FIELD_WORKSPACE, FIELD_WORKSPACE, null)); UIFormStringInput homePathField = new UIFormStringInput(FIELD_HOMEPATH, FIELD_HOMEPATH, null); homePathField.setValue("/"); homePathField.setDisabled(true); addUIFormInput(homePathField); addUIFormInput( new UIFormStringInput(FIELD_WORKSPACEICON, FIELD_WORKSPACEICON, null).setDisabled(true)); UIFormStringInput permissonSelectField = new UIFormStringInput(FIELD_PERMISSION, FIELD_PERMISSION, null); permissonSelectField.addValidator(MandatoryValidator.class); permissonSelectField.addValidator(DrivePermissionValidator.class); permissonSelectField.setDisabled(false); addUIFormInput(permissonSelectField); addUIFormInput(new UICheckBoxInput(FIELD_VIEWPREFERENCESDOC, FIELD_VIEWPREFERENCESDOC, null)); addUIFormInput(new UICheckBoxInput(FIELD_VIEWNONDOC, FIELD_VIEWNONDOC, null)); addUIFormInput(new UICheckBoxInput(FIELD_VIEWSIDEBAR, FIELD_VIEWSIDEBAR, null)); addUIFormInput(new UICheckBoxInput(SHOW_HIDDEN_NODE, SHOW_HIDDEN_NODE, null)); addUIFormInput( new UIFormSelectBox(FIELD_ALLOW_CREATE_FOLDERS, FIELD_ALLOW_CREATE_FOLDERS, null)); UIFormStringInput filterNodeTypes = new UIFormStringInput(FIELD_ALLOW_NODETYPES_ON_TREE, FIELD_ALLOW_NODETYPES_ON_TREE, null); addUIFormInput(filterNodeTypes); setActionInfo(FIELD_ALLOW_NODETYPES_ON_TREE, new String[] {"ChooseNodeType", "RemoveNodeType"}); setActionInfo(FIELD_PERMISSION, new String[] {"AddPermission", "RemovePermission"}); setActionInfo(FIELD_HOMEPATH, new String[] {"AddPath"}); setActionInfo(FIELD_WORKSPACEICON, new String[] {"AddIcon"}); templateService = getApplicationComponent(TemplateService.class); setFoldertypes = templateService.getAllowanceFolderType(); }
/** * constructor * * @param name * @throws Exception */ public UISpaceSettings(String name) throws Exception { super(name); WebuiRequestContext requestContext = WebuiRequestContext.getCurrentInstance(); ResourceBundle resourceBundle = requestContext.getApplicationResourceBundle(); UIFormStringInput spaceDisplayName = new UIFormStringInput(SPACE_DISPLAY_NAME, SPACE_DISPLAY_NAME, null); spaceDisplayName.setHTMLAttribute( HTML_ATTRIBUTE_PLACEHOLDER, resourceBundle.getString("UISpaceSettings.label.spaceDisplayName")); addUIFormInput( spaceDisplayName .addValidator(MandatoryValidator.class) .addValidator( ExpressionValidator.class, "^([\\p{L}\\s\\d\']+[\\s]?)+$", MSG_INVALID_SPACE_NAME) .addValidator(StringLengthValidator.class, 3, 30)); UIFormTextAreaInput description = new UIFormTextAreaInput(SPACE_DESCRIPTION, SPACE_DESCRIPTION, null); description.setHTMLAttribute( HTML_ATTRIBUTE_PLACEHOLDER, resourceBundle.getString("UISpaceSettings.label.spaceDescription")); addUIFormInput(description.addValidator(StringLengthValidator.class, 0, 255)); }
/** * constructor * * @throws Exception */ public UISpaceInfo() throws Exception { WebuiRequestContext requestContext = WebuiRequestContext.getCurrentInstance(); ResourceBundle resourceBundle = requestContext.getApplicationResourceBundle(); UIFormStringInput spaceId = new UIFormStringInput(SPACE_ID, SPACE_ID, null).setRendered(false); spaceId.setHTMLAttribute( HTML_ATTRIBUTE_TITLE, resourceBundle.getString("UISpaceInfo.label.SpaceId")); addUIFormInput(spaceId); UIFormStringInput spaceDisplayName = new UIFormStringInput(SPACE_DISPLAY_NAME, SPACE_DISPLAY_NAME, null); spaceDisplayName.setHTMLAttribute( HTML_ATTRIBUTE_PLACEHOLDER, resourceBundle.getString("UISpaceSettings.label.spaceDisplayName")); addUIFormInput( spaceDisplayName .addValidator(MandatoryValidator.class) .addValidator( ExpressionValidator.class, "^([\\p{L}\\d\']+[\\s]?)+$", "UISpaceInfo.msg.name-invalid") .addValidator(StringLengthValidator.class, 3, 30)); UIFormTextAreaInput description = new UIFormTextAreaInput(SPACE_DESCRIPTION, SPACE_DESCRIPTION, null); description.setHTMLAttribute( HTML_ATTRIBUTE_PLACEHOLDER, resourceBundle.getString("UISpaceSettings.label.spaceDescription")); addUIFormInput(description.addValidator(StringLengthValidator.class, 0, 255)); // temporary disable tag UIFormStringInput tag = new UIFormStringInput(SPACE_TAG, SPACE_TAG, null).setRendered(false); tag.setHTMLAttribute(HTML_ATTRIBUTE_TITLE, resourceBundle.getString("UISpaceInfo.label.tag")); addUIFormInput(tag); PopupContainer popupContainer = createUIComponent(PopupContainer.class, null, null); addChild(popupContainer); }
@Override public void activate() { UIJCRExplorer uiExplorer = getAncestorOfType(UIJCRExplorer.class); try { currentNode = uiExplorer.getCurrentNode(); initParams(); } catch (Exception E) { return; } /** node field */ UIFormStringInput uiFormNameValueStringInput = new UIFormStringInput(NODE, NODE, nameValue_); uiFormNameValueStringInput.setEditable(false); /** visible field */ UIFormCheckBoxInput<Boolean> uiFormVisibleValueCheckBoxInput = new UIFormCheckBoxInput<Boolean>(IS_VISIBLE, IS_VISIBLE, false); uiFormVisibleValueCheckBoxInput.setChecked(isVisible); /** navigation node field */ UIFormStringInput uiFormNavigationNodeValueStringInput = new UIFormStringInput( NAVIGATION_NODE_STRING_INPUT, NAVIGATION_NODE_STRING_INPUT, navigationNode_); uiFormNavigationNodeValueStringInput.setEditable(false); UIFormInputSetWithAction navigationNodeInputSet = new UIFormInputSetWithAction(NAVIGATION_NODE_INPUT_SET); navigationNodeInputSet.setActionInfo( NAVIGATION_NODE_STRING_INPUT, new String[] {"SelectNavigationNode", "RemoveNavigationNode"}); navigationNodeInputSet.addUIFormInput(uiFormNavigationNodeValueStringInput); /** index field */ UIFormStringInput uiFormIndexValueStringInput = new UIFormStringInput(INDEX, INDEX, String.valueOf(index_)); try { uiFormIndexValueStringInput.addValidator(NumberFormatValidator.class); } catch (Exception E) { // TODO : add log } /** clickable field */ UIFormCheckBoxInput<Boolean> uiFormClickableValueCheckBoxInput = new UIFormCheckBoxInput<Boolean>(IS_CLICKABLE, IS_CLICKABLE, false); uiFormClickableValueCheckBoxInput.setChecked(isClickable); /** TARGET PAGE */ UIFormStringInput uiFormTargetPageValueStringInput = new UIFormStringInput( LIST_TARGET_PAGE_STRING_INPUT, LIST_TARGET_PAGE_STRING_INPUT, listTargetPage_); uiFormTargetPageValueStringInput.setEditable(false); UIFormInputSetWithAction targetPageInputSet = new UIFormInputSetWithAction(LIST_TARGET_PAGE_INPUT_SET); targetPageInputSet.setActionInfo( LIST_TARGET_PAGE_STRING_INPUT, new String[] {"SelectListTargetPage", "RemoveListTargetPage"}); targetPageInputSet.addUIFormInput(uiFormTargetPageValueStringInput); /** DETAIL_TARGET PAGE */ UIFormStringInput uiFormDetailTargetPageValueStringInput = new UIFormStringInput( DETAIL_TARGET_PAGE_STRING_INPUT, DETAIL_TARGET_PAGE_STRING_INPUT, detailTargetPage_); uiFormDetailTargetPageValueStringInput.setEditable(false); UIFormInputSetWithAction detailTargetPageInputSet = new UIFormInputSetWithAction(DETAIL_TARGET_PAGE_INPUT_SET); detailTargetPageInputSet.setActionInfo( DETAIL_TARGET_PAGE_STRING_INPUT, new String[] {"SelectDetailTargetPage", "RemoveDetailTargetPage"}); detailTargetPageInputSet.addUIFormInput(uiFormDetailTargetPageValueStringInput); /* if (!navigationNode_.equals("")) { uiFormIndexValueStringInput.setEnable(false); uiFormClickableValueRadioBoxInput.setEnable(false); } */ addChild(uiFormNameValueStringInput); addChild(uiFormVisibleValueCheckBoxInput); addChild(navigationNodeInputSet); if (renderIndexField) { addChild(uiFormIndexValueStringInput); } addChild(uiFormClickableValueCheckBoxInput); addChild(targetPageInputSet); addChild(detailTargetPageInputSet); setActions(new String[] {"Save", "Cancel"}); }