Package javax.portlet

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


    }

    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

    {
        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

    {
        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

    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

    }

    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

  {
    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

{
    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

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.