Package org.exoplatform.webui.core.model

Examples of org.exoplatform.webui.core.model.SelectItemOption


        UIPortal uiPortal = Util.getUIPortal();
        List<SelectItemCategory> itemCategories = new ArrayList<SelectItemCategory>();
        SkinService skinService = uiPortal.getApplicationComponent(SkinService.class);
        for (String skin : skinService.getAvailableSkinNames()) {
            SelectItemCategory skinCategory = new SelectItemCategory(skin, false);
            skinCategory.addSelectItemOption(new SelectItemOption(skin, skin, skin));
            itemCategories.add(skinCategory);
        }
        itemCategories.get(0).setSelected(true);

        UIPortalApplication uiPortalApp = uiPortal.getAncestorOfType(UIPortalApplication.class);
View Full Code Here


    @SuppressWarnings("unchecked")
    public UILanguageSelector() throws Exception {
        name_ = "UIChangeLanguage";
        LocaleConfigService configService = getApplicationComponent(LocaleConfigService.class);
        Locale currentLocale = Util.getPortalRequestContext().getLocale();
        SelectItemOption localeItem = null;
        List<SelectItemOption> optionsList = new ArrayList<SelectItemOption>();

        for (Object object : configService.getLocalConfigs()) {
            LocaleConfig localeConfig = (LocaleConfig) object;
            Locale locale = localeConfig.getLocale();
            String lang = locale.getLanguage();
            String country = locale.getCountry();

            ResourceBundle currentLocaleResourceBundle = getResourceBundle(currentLocale);
            ResourceBundle localeResourceBundle = getResourceBundle(locale);

            String key = "Locale." + lang;

            String displayName = null;
            try {
                String translation = currentLocaleResourceBundle.getString(key);
                displayName = translation;
            } catch (MissingResourceException e) {
                displayName = capitalizeFirstLetter(locale.getDisplayLanguage(currentLocale));
            }

            String localedName = null;
            try {
                String translation = localeResourceBundle.getString(key);
                localedName = translation;
            } catch (MissingResourceException e) {
                localedName = capitalizeFirstLetter(locale.getDisplayLanguage(locale));
            }

            if (country != null && country.length() > 0) {
                lang = lang + "_" + country;
                key = "Locale." + lang;

                try {
                    String translation = currentLocaleResourceBundle.getString(key);
                    displayName = translation;
                } catch (MissingResourceException e) {
                    displayName = capitalizeFirstLetter(locale.getDisplayLanguage(currentLocale)) + " - "
                            + capitalizeFirstLetter(locale.getDisplayCountry(currentLocale));
                }

                try {
                    String translation = localeResourceBundle.getString(key);
                    localedName = translation;
                } catch (MissingResourceException e) {
                    localedName = capitalizeFirstLetter(locale.getDisplayLanguage(locale)) + " - "
                            + capitalizeFirstLetter(locale.getDisplayCountry(locale));
                }
            }

            if (localedName == null || localedName.length() == 0)
                localedName = "???";
            if (locale.getDisplayName().equalsIgnoreCase(currentLocale.getDisplayName())) {
                localeItem = new SelectItemOption(displayName, lang, localedName, "", true);
            } else {
                localeItem = new SelectItemOption(displayName, lang, localedName, "");
            }
            optionsList.add(localeItem);
        }
        // TODO need use other UIComponent here
        Collections.sort(optionsList, new LanguagesComparator());
View Full Code Here

   public Object getValue()
   {
      SelectItemCategory selectedCategory = getSelectedCategory();
      if (selectedCategory == null)
         return null;
      SelectItemOption selectedItem = selectedCategory.getSelectedItemOption();
      if (selectedItem == null)
         return null;
      return selectedItem.getValue();
   }
View Full Code Here

   public UILanguageSelector() throws Exception
   {
      name_ = "UIChangeLanguage";
      LocaleConfigService configService = getApplicationComponent(LocaleConfigService.class);
      Locale currentLocale = Util.getPortalRequestContext().getLocale();
      SelectItemOption localeItem = null;
      List<SelectItemOption> optionsList = new ArrayList<SelectItemOption>();

      for (Object object : configService.getLocalConfigs())
      {
         LocaleConfig localeConfig = (LocaleConfig)object;
         Locale locale = localeConfig.getLocale();
         String displayName = capitalizeFirstLetter(locale.getDisplayLanguage(currentLocale));
         String lang = locale.getLanguage();
         String country = locale.getCountry();
         String localedName = capitalizeFirstLetter(locale.getDisplayLanguage(locale));;

         if (country != null && country.length() > 0)
         {
          displayName = capitalizeFirstLetter(locale.getDisplayLanguage(currentLocale)) + " - " + capitalizeFirstLetter(locale.getDisplayCountry(currentLocale));
            localedName = capitalizeFirstLetter(locale.getDisplayLanguage(locale)) + " - " + capitalizeFirstLetter(locale.getDisplayCountry(locale));
            lang = lang + "_" + country;
         }

         if (localedName == null || localedName.length() == 0)
            localedName = "???";
         if (locale.getDisplayName().equalsIgnoreCase(currentLocale.getDisplayName()))
         {
            localeItem = new SelectItemOption(displayName, lang, localedName, "", true);
         }
         else
         {
            localeItem = new SelectItemOption(displayName, lang, localedName, "");
         }
         optionsList.add(localeItem);
      }
      // TODO need use other UIComponent here
      Collections.sort(optionsList, new LanguagesComparator());
View Full Code Here

      List<SelectItemCategory> itemCategories = new ArrayList<SelectItemCategory>();
      SkinService skinService = uiPortal.getApplicationComponent(SkinService.class);
      for (String skin : skinService.getAvailableSkinNames())
      {
         SelectItemCategory skinCategory = new SelectItemCategory(skin, false);
         skinCategory.addSelectItemOption(new SelectItemOption(skin, skin, skin));
         itemCategories.add(skinCategory);
      }
      itemCategories.get(0).setSelected(true);

      UIPortalApplication uiPortalApp = uiPortal.getAncestorOfType(UIPortalApplication.class);
View Full Code Here

    @SuppressWarnings("unchecked")
    public UILanguageSelector() throws Exception {
        name_ = "UIChangeLanguage";
        LocaleConfigService configService = getApplicationComponent(LocaleConfigService.class);
        Locale currentLocale = Util.getPortalRequestContext().getLocale();
        SelectItemOption localeItem = null;
        List<SelectItemOption> optionsList = new ArrayList<SelectItemOption>();

        for (Object object : configService.getLocalConfigs()) {
            LocaleConfig localeConfig = (LocaleConfig) object;
            Locale locale = localeConfig.getLocale();
            String lang = locale.getLanguage();
            String country = locale.getCountry();

            ResourceBundle currentLocaleResourceBundle = getResourceBundle(currentLocale);
            ResourceBundle localeResourceBundle = getResourceBundle(locale);

            String key = "Locale." + lang;

            String displayName = null;
            try {
                String translation = currentLocaleResourceBundle.getString(key);
                displayName = translation;
            } catch (MissingResourceException e) {
                displayName = capitalizeFirstLetter(locale.getDisplayLanguage(currentLocale));
            }

            String localedName = null;
            try {
                String translation = localeResourceBundle.getString(key);
                localedName = translation;
            } catch (MissingResourceException e) {
                localedName = capitalizeFirstLetter(locale.getDisplayLanguage(locale));
            }

            if (country != null && country.length() > 0) {
                lang = lang + "_" + country;
                key = "Locale." + lang;

                try {
                    String translation = currentLocaleResourceBundle.getString(key);
                    displayName = translation;
                } catch (MissingResourceException e) {
                    displayName = capitalizeFirstLetter(locale.getDisplayLanguage(currentLocale)) + " - "
                            + capitalizeFirstLetter(locale.getDisplayCountry(currentLocale));
                }

                try {
                    String translation = localeResourceBundle.getString(key);
                    localedName = translation;
                } catch (MissingResourceException e) {
                    localedName = capitalizeFirstLetter(locale.getDisplayLanguage(locale)) + " - "
                            + capitalizeFirstLetter(locale.getDisplayCountry(locale));
                }
            }

            if (localedName == null || localedName.length() == 0)
                localedName = "???";
            if (locale.getDisplayName().equalsIgnoreCase(currentLocale.getDisplayName())) {
                localeItem = new SelectItemOption(displayName, lang, localedName, "", true);
            } else {
                localeItem = new SelectItemOption(displayName, lang, localedName, "");
            }
            optionsList.add(localeItem);
        }
        // TODO need use other UIComponent here
        Collections.sort(optionsList, new LanguagesComparator());
View Full Code Here

        categories_ = (List<SelectItemCategory>) param.getFreshObject(context);
        selectedItemOption_ = getDefaultItemOption();
        List<SelectItemOption<String>> itemOptions = new ArrayList<SelectItemOption<String>>();

        for (SelectItemCategory itemCategory : categories_) {
            itemOptions.add(new SelectItemOption(itemCategory.getName()));
        }

        // modify: Dang.Tung
        UIDropDownControl uiItemSelector = addChild(UIDropDownControl.class, null, "UIDropDownPageTemp");
        uiItemSelector.setOptions(itemOptions);
View Full Code Here

        UIPortal uiPortal = Util.getUIPortal();
        List<SelectItemCategory> itemCategories = new ArrayList<SelectItemCategory>();
        SkinService skinService = uiPortal.getApplicationComponent(SkinService.class);
        for (String skin : skinService.getAvailableSkinNames()) {
            SelectItemCategory skinCategory = new SelectItemCategory(skin, false);
            skinCategory.addSelectItemOption(new SelectItemOption(skin, skin, skin));
            itemCategories.add(skinCategory);
        }
        itemCategories.get(0).setSelected(true);

        UIPortalApplication uiPortalApp = uiPortal.getAncestorOfType(UIPortalApplication.class);
View Full Code Here

   public UILanguageSelector() throws Exception
   {
      name_ = "UIChangeLanguage";
      LocaleConfigService configService = getApplicationComponent(LocaleConfigService.class);
      Locale currentLocale = Util.getPortalRequestContext().getLocale();
      SelectItemOption localeItem = null;
      List<SelectItemOption> optionsList = new ArrayList<SelectItemOption>();

      for (Object object : configService.getLocalConfigs())
      {
         LocaleConfig localeConfig = (LocaleConfig)object;
         Locale locale = localeConfig.getLocale();
         String displayName = capitalizeFirstLetter(locale.getDisplayLanguage(currentLocale));
         String lang = locale.getLanguage();
         String country = locale.getCountry();
         String localedName = capitalizeFirstLetter(locale.getDisplayLanguage(locale));;

         if (country != null && country.length() > 0)
         {
          displayName = capitalizeFirstLetter(locale.getDisplayLanguage(currentLocale)) + " - " + capitalizeFirstLetter(locale.getDisplayCountry(currentLocale));
            localedName = capitalizeFirstLetter(locale.getDisplayLanguage(locale)) + " - " + capitalizeFirstLetter(locale.getDisplayCountry(locale));
            lang = lang + "_" + country;
         }

         if (localedName == null || localedName.length() == 0)
            localedName = "???";
         if (locale.getDisplayName().equalsIgnoreCase(currentLocale.getDisplayName()))
         {
            localeItem = new SelectItemOption(displayName, lang, localedName, "", true);
         }
         else
         {
            localeItem = new SelectItemOption(displayName, lang, localedName, "");
         }
         optionsList.add(localeItem);
      }
      // TODO need use other UIComponent here
      Collections.sort(optionsList, new LanguagesComparator());
View Full Code Here

      List<SelectItemCategory> itemCategories = new ArrayList<SelectItemCategory>();
      SkinService skinService = uiPortal.getApplicationComponent(SkinService.class);
      for (String skin : skinService.getAvailableSkinNames())
      {
         SelectItemCategory skinCategory = new SelectItemCategory(skin, false);
         skinCategory.addSelectItemOption(new SelectItemOption(skin, skin, skin));
         itemCategories.add(skinCategory);
      }
      itemCategories.get(0).setSelected(true);

      UIPortalApplication uiPortalApp = uiPortal.getAncestorOfType(UIPortalApplication.class);
View Full Code Here

TOP

Related Classes of org.exoplatform.webui.core.model.SelectItemOption

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.