Package org.apache.pluto.om.common

Examples of org.apache.pluto.om.common.Preference


        preferenceSet.remove(pref);
    }

    public Preference remove(String name)
    {
        Preference pref = (Preference) prefs.remove(name);
        preferenceSet.remove(name);
        return pref;
    }
View Full Code Here


            HttpServletRequest request)
    {
        Locale locale = request.getLocale();
        String titleKey = createTitleKey(locale, false);

        Preference titlePref = window.getPortletEntity().getPreferenceSet()
                .get(titleKey);
        if (titlePref == null)
        {
            titleKey = createTitleKey(locale, true);
            titlePref = window.getPortletEntity().getPreferenceSet().get(
                    titleKey);
        }

        if (titlePref != null)
        {
            Iterator values = titlePref.getValues();
            if (values.hasNext())
            {
                return (String) titlePref.getValues().next();
            }
        }

        return null;
    }
View Full Code Here

        PreferenceSet preferenceSet = this.pagePreferenceSet;
        List preferences = new ArrayList();
       
        for (Iterator it = preferenceSet.iterator(); it.hasNext(); )
        {
            Preference pref = (Preference) it.next();
           
            FragmentPreference preference = pm.newFragmentPreference();
            preference.setName(pref.getName());
            List preferenceValues = new ArrayList();
           
            for (Iterator iterVals = pref.getValues(); iterVals.hasNext(); )
            {
                preferenceValues.add(iterVals.next());
            }
           
            preference.setValueList(preferenceValues);
View Full Code Here

        Fragment fragment = (Fragment) unmar.unmarshal(new InputSource(getClass().getClassLoader().getResourceAsStream(
                "fragment-test.xml")));
       
        assertNotNull(fragment);
        assertEquals(1, fragment.getPreferences().size());
        Preference pref = (Preference) fragment.getPreferences().get(0);
       
        assertEquals("Google", pref.getName());
        assertEquals(false, pref.isReadOnly());
        Iterator itr = pref.getValues();
        String value = (String )itr.next();
        assertEquals("http://www.google.com", value );

    }
View Full Code Here

        PreferenceSet preferenceSet = this.pagePreferenceSet;
        List preferences = new ArrayList();
       
        for (Iterator it = preferenceSet.iterator(); it.hasNext(); )
        {
            Preference pref = (Preference) it.next();
           
            FragmentPreference preference = pm.newFragmentPreference();
            preference.setName(pref.getName());
            List preferenceValues = new ArrayList();
           
            for (Iterator iterVals = pref.getValues(); iterVals.hasNext(); )
            {
                preferenceValues.add(iterVals.next());
            }
           
            preference.setValueList(preferenceValues);
View Full Code Here

        // if managing the first layer of the preferences
        // modifiable returns always true (for administration purposes)
        if (preferenceSetList.size() != 1)
        { // otherwise
            // iterate through all preferences
            Preference preference = null;
            ListIterator iter = preferenceSetList.listIterator();
            while ((preference == null) && (iter.hasNext()))
            {
                preference = ((PreferenceSet)iter.next()).get(key);
            }
            if (preference != null)
            {
                isReadOnly = preference.isReadOnly();
            }
        }
        return isReadOnly;
    }
View Full Code Here

        {
            iter.next();
        }

        // iterate through all preference sets
        Preference preference = null;
        while ((preference == null) && (iter.hasNext()))
        {
            preference = ((PreferenceSet)iter.next()).get(key);
        }

        if (preference == null || !preference.isValueSet())
        {
            // if preference not exists
            return def;
        }
        else
View Full Code Here

                for (int i=0;i<values.length;i++)
                    newValues.add(values[i]);
            }

            // transfer changings
            Preference preference = preferences.get(key);
            if (preference != null)
            {
                // change preference
                PreferenceCtrl preferenceCtrl = (PreferenceCtrl)ControllerObjectAccess.get(preference);
                preferenceCtrl.setValues(newValues);
View Full Code Here

    public Preference get(String name)
    {
        Iterator iterator = this.iterator();
        while (iterator.hasNext()) {
            Preference preference = (Preference)iterator.next();
            if (preference.getName().equals(name)) {
                return preference;
            }
        }
        return null;
    }
View Full Code Here

    public Preference remove(String name)
    {
        Iterator iterator = this.iterator();
        while (iterator.hasNext()) {
            Preference preference = (Preference)iterator.next();
            if (preference.getName().equals(name)) {
                super.remove(preference);
                return preference;
            }
        }
        return null;
View Full Code Here

TOP

Related Classes of org.apache.pluto.om.common.Preference

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.