Examples of PortletPreferences


Examples of javax.portlet.PortletPreferences

        boolean useCaptcha;
        if (skipCaptcha) {
            useCaptcha = false;
        } else {
            PortletRequestContext pcontext = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
            PortletPreferences pref = pcontext.getRequest().getPreferences();
            useCaptcha = Boolean.parseBoolean(pref.getValue(UIRegisterEditMode.USE_CAPTCHA, "true"));
        }

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

Examples of javax.portlet.PortletPreferences

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

Examples of javax.portlet.PortletPreferences

        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
            UIComponent registerPortlet = uiForm.getParent();
            UIRegisterInputSet registerInputSet = registerPortlet.findFirstComponentOfType(UIRegisterInputSet.class);
View Full Code Here

Examples of javax.portlet.PortletPreferences

    }

    public void setupPreferencesEdit(RenderRequest request, RenderResponse response)
    {
        Context context = getContext(request);
        PortletPreferences prefs = request.getPreferences();
        Map map = prefs.getMap();
        Iterator it = map.entrySet().iterator();
        context.put("prefs", it);
       
        Map result = new HashMap(map.size());
        Iterator f = map.entrySet().iterator();
View Full Code Here

Examples of javax.portlet.PortletPreferences

    {
        String key = "none";

        try
        {
            PortletPreferences prefs = request.getPreferences();
            Iterator it = bean.entrySet().iterator();
            while (it.hasNext())
            {
                Map.Entry entry = (Map.Entry) it.next();
                key = (String) entry.getKey();
                if (!prefs.isReadOnly(key))
                {
                    prefs.setValue(key, (String) entry.getValue());
                }
            }
            prefs.store();
        }
        catch (ReadOnlyException roe)
        {
            throw new PortletException("Failed to set preference " + key + ", value is readonly");
        }
View Full Code Here

Examples of javax.portlet.PortletPreferences

    {
        Map params = request.getParameterMap();
        Map bean = (Map) request.getPortletSession().getAttribute(view + PREFS_SUFFIX);
        if (bean == null)
        {
            PortletPreferences prefs = request.getPreferences();

            bean = model.createPrefsBean(mb, prefs.getMap());

            request.getPortletSession().setAttribute(view + PREFS_SUFFIX, bean);
        }

        try
View Full Code Here

Examples of javax.portlet.PortletPreferences

    private void preferencesToContext(RenderRequest request, String view, ModelBean mb)
    {
        Map bean = (Map) request.getPortletSession().getAttribute(view + PREFS_SUFFIX);
        if (bean == null)
        {
            PortletPreferences prefs = request.getPreferences();
            bean = model.createPrefsBean(mb, prefs.getMap());
            putBeanInSession(request, mb, bean);
        }
        putRequestVariable(request, FrameworkConstants.PREFS_VARIABLE, bean);
    }
View Full Code Here

Examples of javax.portlet.PortletPreferences

    }

    public void deleteDOMTree( String name, PortletRequest request )
    {
      if ( name == null ) name = "";
      PortletPreferences prefs = request.getPreferences();
      try
    {
        prefs.reset( name );
        prefs.store();
    }
    catch ( ReadOnlyException e ) { }
    catch ( IOException e ) { }
    catch ( ValidatorException e ) { }
    }
View Full Code Here

Examples of javax.portlet.PortletPreferences

  {
    if ( addTo == null )
    {
      addTo = new ArrayList();
    }
    PortletPreferences prefs = request.getPreferences();
        Enumeration e = prefs.getNames();
        while ( e.hasMoreElements() )
        {
          String name = (String)e.nextElement();
          String path = prefs.getValue( name, "" );
          addTo.add( new DOMTree( name, path ) );
        }
      return (SortedSet) new TreeSet( addTo );
    }
View Full Code Here

Examples of javax.portlet.PortletPreferences

{
    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
TOP
Copyright © 2018 www.massapi.com. 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.