Package javax.portlet

Examples of javax.portlet.PortletPreferences


        addUIFormInput(new UIFormStringInput(EMAIL_ADDRESS, EMAIL_ADDRESS, null).addValidator(MandatoryValidator.class)
                .addValidator(EmailAddressValidator.class));

        PortletRequestContext pcontext = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
        PortletPreferences pref = pcontext.getRequest().getPreferences();
        boolean useCaptcha = Boolean.parseBoolean(pref.getValue(UIRegisterEditMode.USE_CAPTCHA, "true"));

        if (useCaptcha) {
            addUIFormInput(new UICaptcha(CAPTCHA, CAPTCHA, null).addValidator(MandatoryValidator.class).addValidator(
                    CaptchaValidator.class));
            this.captchaInputAvailability = true;
View Full Code Here


public class UIRegisterEditMode extends UIForm {
    public static final String USE_CAPTCHA = "useCaptcha";

    public UIRegisterEditMode() {
        PortletRequestContext pcontext = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
        PortletPreferences pref = pcontext.getRequest().getPreferences();
        boolean useCaptcha = Boolean.parseBoolean(pref.getValue(USE_CAPTCHA, "true"));
        addUIFormInput(new UIFormCheckBoxInput<Boolean>(USE_CAPTCHA, USE_CAPTCHA, useCaptcha).setValue(useCaptcha));
    }
View Full Code Here

        public void execute(Event<UIRegisterEditMode> event) throws Exception {
            // TODO Auto-generated method stub
            UIRegisterEditMode uiForm = event.getSource();
            boolean useCaptcha = uiForm.getUIFormCheckBoxInput(USE_CAPTCHA).isChecked();
            PortletRequestContext pcontext = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
            PortletPreferences pref = pcontext.getRequest().getPreferences();
            pref.setValue(USE_CAPTCHA, Boolean.toString(useCaptcha));
            pref.store();

            // Show/hide the captcha input in UIRegisterInputSet
            UIRegisterPortlet registerPortlet = uiForm.getParent();
            UIRegisterInputSet registerInputSet = registerPortlet.findFirstComponentOfType(UIRegisterInputSet.class);
View Full Code Here

    public static final int DEFAULT_LEVEL = 2;

    public UIPortalNavigationPortlet() throws Exception {
        PortletRequestContext context = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
        PortletRequest prequest = context.getRequest();
        PortletPreferences prefers = prequest.getPreferences();
        int level = DEFAULT_LEVEL;
        try {
            level = Integer.valueOf(prefers.getValue("level", String.valueOf(DEFAULT_LEVEL)));
        } catch (Exception ex) {
            log.warn("Preference for navigation level can only be integer");
        }

        UISiteManagement siteManagement = addChild(UISiteManagement.class, null, null);
View Full Code Here

    final StringBuffer lStringBuffer= new StringBuffer();
    request.getUserPrincipal();
    request.isUserInRole("user");
    // Get our preferences
    PortletPreferences pref = request.getPreferences();

    // Get the value of "displaytext" from our preferences, if not available,
    // then use the second string passed to the function
    String displayText = pref.getValue("displaytext", "MISSING: display-text");
    // displays the string from our preferences

    response.setContentType(request.getResponseContentType());

    String param = request.getParameter("param");
View Full Code Here

{
    static public void requestParamsToPreferences(ActionRequest request)
        throws PortletException
    {
        Map params = request.getParameterMap();
        PortletPreferences prefs = request.getPreferences();
        Map prefsMap = prefs.getMap();

        try
        {
            Iterator it = params.entrySet().iterator();
            while (it.hasNext())
            {
                Map.Entry entry = (Map.Entry) it.next();
                Object value = entry.getValue();
                String key = (String) entry.getKey();
                if (null == prefsMap.get(key))
                {
                    continue;
                }
                if (value instanceof String)
                {
                    prefs.setValue(key, (String)value);
                }
                else if (value instanceof String[])
                {
                    prefs.setValue(key, ((String[]) value)[0]);
                }
            }
        }
        catch (Exception e)
        {
View Full Code Here

    throws PortletException, IOException
    {
        String actionPage = this.defaultActionPage;
        if (this.allowPreferences == true)
        {
            PortletPreferences prefs = request.getPreferences();
            if (prefs != null)
            {
                actionPage = prefs.getValue(PARAM_ACTION_PAGE, this.defaultActionPage);
            }
        }


        if (actionPage != null)
View Full Code Here

    throws PortletException, IOException
    {
        String customPage = this.defaultCustomPage;
        if (this.allowPreferences == true)
        {
            PortletPreferences prefs = request.getPreferences();
            // allow ViewPage override by the request
            customPage = (String) request.getAttribute(PARAM_CUSTOM_PAGE);           
           
            if (prefs != null && customPage == null)
            {
                customPage = prefs.getValue(PARAM_CUSTOM_PAGE, this.defaultCustomPage);
            }
        }

        if (customPage != null)
        {
View Full Code Here

            editPage = reqEditPage;
        }
       
        if (this.allowPreferences == true)
        {                      
            PortletPreferences prefs = request.getPreferences();

            if (prefs != null && reqEditPage == null)
            {
                editPage = prefs.getValue(PARAM_EDIT_PAGE, this.defaultEditPage);
            }
        }

        if (editPage != null)
        {
View Full Code Here

        }
       
        if (this.allowPreferences == true)
        {

            PortletPreferences prefs = request.getPreferences();

            if (prefs != null && reqHelpPage == null)
            {
                helpPage = prefs.getValue(PARAM_HELP_PAGE, this.defaultHelpPage);
            }
        }

        if (helpPage != null)
        {
View Full Code Here

TOP

Related Classes of javax.portlet.PortletPreferences

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.