Package org.apache.struts.util

Examples of org.apache.struts.util.LabelValueBean


      query.setParameter("siteId", siteId);
       Iterator<?> iterator = query.getResultList().iterator();
       Vector<LabelValueBean> vector = new Vector<LabelValueBean>();
       while (iterator.hasNext()) {
         Country country = (Country) iterator.next();
         LabelValueBean bean = new LabelValueBean(country.getCountryName(), country.getCountryCode());
         vector.add(bean);
       }
       LabelValueBean countries[] = new LabelValueBean[vector.size()];
       vector.copyInto(countries);
       form.setCountries(countries);

       String sql = "";
       sql = "select   state " +
           "from    State state " +
              "left      join state.country country " +
              "where  country.siteId = :siteId " +
              "order  by country.countryId, state.stateName";
       query = em.createQuery(sql);
      query.setParameter("siteId", siteId);
       iterator = query.getResultList().iterator();
       vector = new Vector<LabelValueBean>();
       while (iterator.hasNext()) {
         State state = (State) iterator.next();
         LabelValueBean bean = new LabelValueBean(state.getStateName(), state.getStateCode());
         vector.add(bean);
       }
       LabelValueBean states[] = new LabelValueBean[vector.size()];
       vector.copyInto(states);
       form.setStates(states);
      
       vector = new Vector<LabelValueBean>();
       vector.add(new LabelValueBean("Open", "O"));
       vector.add(new LabelValueBean("Closed", "C"));
       LabelValueBean orderStatuses[] = new LabelValueBean[vector.size()];
       vector.copyInto(orderStatuses);
       form.setOrderStatuses(orderStatuses);
    }
View Full Code Here


   
    public void initInfo(AdminListingActionForm actionForm, HttpServletRequest request) throws Exception {
      OrderListingActionForm form = (OrderListingActionForm) actionForm;
    MessageResources resources = this.getResources(request);
       Vector<LabelValueBean> vector = new Vector<LabelValueBean>();
       vector.add(new LabelValueBean(resources.getMessage("order.step.CT"), "CT"));
       vector.add(new LabelValueBean(resources.getMessage("order.step.RA"), "RA"));
       vector.add(new LabelValueBean(resources.getMessage("order.step.RP"), "RP"));
       vector.add(new LabelValueBean(resources.getMessage("order.step.CC"), "CC"));
       vector.add(new LabelValueBean(resources.getMessage("order.step.PP"), "PP"));
       vector.add(new LabelValueBean(resources.getMessage("order.step.SQ"), "SQ"));
       vector.add(new LabelValueBean(resources.getMessage("order.step.Q_CT"), "Q_CT"));
       vector.add(new LabelValueBean(resources.getMessage("order.step.Q_RP"), "Q_RP"));
       vector.add(new LabelValueBean(resources.getMessage("order.step.Q_CC"), "Q_CC"));
      LabelValueBean orderAbundantLocs[] = new LabelValueBean[vector.size()];
       vector.copyInto(orderAbundantLocs);
       form.setOrderAbundantLocs(orderAbundantLocs);
    }
View Full Code Here

        Query query = em.createQuery("from ShippingType where siteId = :siteId order by shippingTypeName");
        query.setParameter("siteId", form.getSiteId());
        Iterator<?> iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
          ShippingType shippingType = (ShippingType) iterator.next();
          LabelValueBean bean = new LabelValueBean();
          bean.setLabel(shippingType.getShippingTypeName());
          bean.setValue(shippingType.getShippingTypeId().toString());
          vector.add(bean);
        }
        LabelValueBean shippingTypes[] = new LabelValueBean[vector.size()];
        vector.copyInto(shippingTypes);
        form.setShippingTypes(shippingTypes);
       
        vector = new Vector<LabelValueBean>();
        query = em.createQuery("from CustomerClass where siteId = :siteId order by custClassId");
        query.setParameter("siteId", form.getSiteId());
        iterator = query.getResultList().iterator();
        vector.add(new LabelValueBean("", ""));
        while (iterator.hasNext()) {
          CustomerClass customerClass = (CustomerClass) iterator.next();
          LabelValueBean bean = new LabelValueBean();
          bean.setLabel(customerClass.getCustClassName());
          bean.setValue(customerClass.getCustClassId().toString());
          vector.add(bean);
        }
        LabelValueBean customerClasses[] = new LabelValueBean[vector.size()];
        vector.copyInto(customerClasses);
        form.setCustomerClasses(customerClasses);
       
        vector = new Vector<LabelValueBean>();
        query = em.createQuery("from Template where siteId = :siteId and templateName = :templateName order by templateId");
        query.setParameter("siteId", form.getSiteId());
        query.setParameter("templateName", Constants.TEMPLATE_BASIC);
        iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
          Template template = (Template) iterator.next();
          LabelValueBean bean = new LabelValueBean(template.getTemplateName(),Format.getLong(template.getTemplateId()));
          vector.add(bean);
        }
       
        query = em.createQuery("from Template where siteId = :siteId and templateName != :templateName order by templateId");
        query.setParameter("siteId", form.getSiteId());
        query.setParameter("templateName", Constants.TEMPLATE_BASIC);
        iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
          Template template = (Template) iterator.next();
          LabelValueBean bean = new LabelValueBean(template.getTemplateName(),Format.getLong(template.getTemplateId()));
          vector.add(bean);
        }
        LabelValueBean templates[] = new LabelValueBean[vector.size()];
        vector.copyInto(templates);
        form.setTemplates(templates);
       
       String sql = "";
       sql = "from    State state " +
              "left  join fetch state.country country " +
              "where  country.siteId = :siteId " +
              "order  by country.countryId, state.stateName";
       query = em.createQuery(sql);
      query.setParameter("siteId", form.getSiteId());
       iterator = query.getResultList().iterator();
       vector = new Vector<LabelValueBean>();
       while (iterator.hasNext()) {
         State state = (State) iterator.next();
         LabelValueBean bean = new LabelValueBean(state.getStateName(), state.getStateCode());
         vector.add(bean);
       }
       LabelValueBean states[] = new LabelValueBean[vector.size()];
       vector.copyInto(states);
       form.setStates(states);

        vector = new Vector<LabelValueBean>();
        query = em.createQuery("from Country where siteId = :siteId order by countryName");
        query.setParameter("siteId", form.getSiteId());
        iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
          Country country = (Country) iterator.next();
          LabelValueBean bean = new LabelValueBean();
          bean.setLabel(country.getCountryName());
          bean.setValue(country.getCountryCode());
          vector.add(bean);
        }
        LabelValueBean countries[] = new LabelValueBean[vector.size()];
        vector.copyInto(countries);
        form.setCountries(countries);

    if (Format.isNullOrEmpty(form.getTabIndex())) {
      form.setTabIndex("0");
    }
   
    vector = new Vector<LabelValueBean>();
    vector.add(new LabelValueBean("", ""));
        query = em.createQuery("from PaymentGateway where siteId = :siteId order by paymentGatewayName");
        query.setParameter("siteId", form.getSiteId());
        iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
          PaymentGateway paymentGateway = (PaymentGateway) iterator.next();
          LabelValueBean bean = new LabelValueBean(paymentGateway.getPaymentGatewayName(), Format.getLong(paymentGateway.getPaymentGatewayId()));
          vector.add(bean);
        }
        LabelValueBean paymentGateways[] = new LabelValueBean[vector.size()];
        vector.copyInto(paymentGateways);
        form.setPaymentGateways(paymentGateways);
       
    vector = new Vector<LabelValueBean>();
    vector.add(new LabelValueBean("", ""));
        query = em.createQuery("from PaymentGateway where siteId = :siteId and paymentGatewayProvider = :paymentGatewayProvider order by paymentGatewayName");
        query.setParameter("siteId", form.getSiteId());
        query.setParameter("paymentGatewayProvider", PaymentExpressEngine.class.getSimpleName());
        iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
          PaymentGateway paymentGateway = (PaymentGateway) iterator.next();
          LabelValueBean bean = new LabelValueBean(paymentGateway.getPaymentGatewayName(), Format.getLong(paymentGateway.getPaymentGatewayId()));
          vector.add(bean);
        }
        LabelValueBean payPalPaymentGateways[] = new LabelValueBean[vector.size()];
        vector.copyInto(payPalPaymentGateways);
        form.setPayPalPaymentGateways(payPalPaymentGateways);
       
    vector = new Vector<LabelValueBean>();
        query = em.createQuery("from SiteProfileClass siteProfileClass where siteProfileClass.site.siteId = :siteId order by siteProfileClassName");
        query.setParameter("siteId", form.getSiteId());
        iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
          SiteProfileClass siteProfileClass = (SiteProfileClass) iterator.next();
          LabelValueBean bean = new LabelValueBean(siteProfileClass.getSiteProfileClassName(), Format.getLong(siteProfileClass.getSiteProfileClassId()));
          vector.add(bean);
        }
        LabelValueBean siteProfileClasses[] = new LabelValueBean[vector.size()];
        vector.copyInto(siteProfileClasses);
        form.setSiteProfileClasses(siteProfileClasses);
       
    vector = new Vector<LabelValueBean>();
        query = em.createQuery("from SiteCurrencyClass siteCurrencyClass where siteCurrencyClass.site.siteId = :siteId order by siteCurrencyClassName");
        query.setParameter("siteId", form.getSiteId());
        iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
          SiteCurrencyClass siteCurrencyClass = (SiteCurrencyClass) iterator.next();
          LabelValueBean bean = new LabelValueBean(siteCurrencyClass.getSiteCurrencyClassName(), Format.getLong(siteCurrencyClass.getSiteCurrencyClassId()));
          vector.add(bean);
        }
        LabelValueBean siteCurrencyClasses[] = new LabelValueBean[vector.size()];
        vector.copyInto(siteCurrencyClasses);
        form.setSiteCurrencyClasses(siteCurrencyClasses);
   
        /*
    form.getSiteProfiles()[0].setActive(true);
    form.getSiteCurrencies()[0].setActive(true);
    */
   
    long time = (new Date()).getTime();
    form.setRandom(String.valueOf(time));
   
    Locale locales[] = Locale.getAvailableLocales();
    Arrays.sort(locales, new LocaleComparator());
    LabelValueBean beans[] = new LabelValueBean[locales.length];
    for (int i = 0; i < locales.length; i++) {
      String value = locales[i].getLanguage();
      if (!Format.isNullOrEmpty(locales[i].getCountry())) {
        value += "-" + locales[i].getCountry();
      }
      beans[i] = new LabelValueBean(locales[i].getDisplayName(), value);
    }
    form.setLocales(beans);
    }
View Full Code Here

                        customAttribValue = language.getCustomAttribValue();
                      }
                    }
                  }
                  }
                  customAttribOptions.add(new LabelValueBean(customAttribValue, customAttribOption));
              }
              itemAttribDetailInfo.setCustomAttribOptions(customAttribOptions);
              break;
          }
         
View Full Code Here

      Vector<?> shippingMethodVector = shoppingCart.getShippingMethods();
      Vector<LabelValueBean> smVector = new Vector<LabelValueBean>();
      iterator = shippingMethodVector.iterator();
      while (iterator.hasNext()) {
        ShippingMethod shippingMethod = (ShippingMethod) iterator.next();
        LabelValueBean bean = new LabelValueBean();
        bean.setLabel(shippingMethod.getShippingMethodLanguage().getShippingMethodName());
        bean.setValue(shippingMethod.getShippingMethodId().toString());
            if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()) {
          for (ShippingMethodLanguage language : shippingMethod.getShippingMethodLanguages()) {
            if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
              if (language.getShippingMethodName() != null) {
                bean.setLabel(language.getShippingMethodName());
              }
              break;
            }
          }
            }
        smVector.add(bean);
      }
      LabelValueBean shippingMethods[] = new LabelValueBean[smVector.size()];
      smVector.copyInto(shippingMethods);
      form.setShippingMethods(shippingMethods);
     
      SiteDomainLanguage siteDomainLanguage = contentBean.getContentSessionBean().getSiteDomain().getSiteDomainLanguage();
      for (SiteDomainLanguage language : contentBean.getContentSessionBean().getSiteDomain().getSiteDomainLanguages()) {
View Full Code Here

      query.setParameter("siteId", siteId);
       Iterator<?> iterator = query.getResultList().iterator();
       Vector<LabelValueBean> vector = new Vector<LabelValueBean>();
       while (iterator.hasNext()) {
         Country country = (Country) iterator.next();
         LabelValueBean bean = new LabelValueBean(country.getCountryName(), country.getCountryCode());
         vector.add(bean);
       }
       LabelValueBean countries[] = new LabelValueBean[vector.size()];
       vector.copyInto(countries);
       form.setCountries(countries);
      
      String sql = "from CreditCard credit_card where siteId = :siteId order by seqNum";
       query = em.createQuery(sql);
      query.setParameter("siteId", siteId);
       iterator = query.getResultList().iterator();
       vector = new Vector<LabelValueBean>();
       while (iterator.hasNext()) {
         CreditCard creditCard = (CreditCard) iterator.next();
         LabelValueBean bean = new LabelValueBean(creditCard.getCreditCardDesc(), creditCard.getCreditCardId().toString());
         vector.add(bean);
       }
       LabelValueBean creditCards[] = new LabelValueBean[vector.size()];
       vector.copyInto(creditCards);
       form.setCreditCards(creditCards);
  
      LabelValueBean expiryMonths[] = {new LabelValueBean("01", "01"),
         new LabelValueBean("02", "02"),
         new LabelValueBean("03", "03"),
         new LabelValueBean("04", "04"),
         new LabelValueBean("05", "05"),
         new LabelValueBean("06", "06"),
         new LabelValueBean("07", "07"),
         new LabelValueBean("08", "08"),
         new LabelValueBean("09", "09"),
         new LabelValueBean("10", "10"),
         new LabelValueBean("11", "11"),
         new LabelValueBean("12", "12")};
    LabelValueBean expiryYears[] = {new LabelValueBean("2011", "2011"),
              new LabelValueBean("2012", "2012"),
              new LabelValueBean("2013", "2013"),
              new LabelValueBean("2014", "2014"),
              new LabelValueBean("2015", "2015"),
              new LabelValueBean("2016", "2016"),
              new LabelValueBean("2017", "2017"),
              new LabelValueBean("2018", "2018"),
              new LabelValueBean("2019", "2019"),
              new LabelValueBean("2020", "2020"),
              new LabelValueBean("2021", "2021"),
              new LabelValueBean("2022", "2022"),
              new LabelValueBean("2023", "2023"),
              new LabelValueBean("2024", "2024"),
              new LabelValueBean("2025", "2025"),
              new LabelValueBean("2026", "2026"),
              new LabelValueBean("2027", "2027"),
              new LabelValueBean("2028", "2028"),
              new LabelValueBean("2029", "2029"),
              };
    form.setExpiryMonths(expiryMonths);
    form.setExpiryYears(expiryYears);
   
    Country estimateCountry = CountryDAO.loadByCountryCode(siteId, form.getEstimateCountryCode());
    Vector<LabelValueBean> estimateStateVector = new Vector<LabelValueBean>();
    if (estimateCountry != null) {
      for (State state : estimateCountry.getStates()) {
        LabelValueBean bean = new LabelValueBean(state.getStateName(), state.getStateCode());
        estimateStateVector.add(bean);
      }
      LabelValueBean states[] = new LabelValueBean[estimateStateVector.size()];
      estimateStateVector.copyInto(states);
         form.setEstimateStates(states);
    }
    else {
      LabelValueBean states[] = {};
         form.setEstimateStates(states);
    }
   
    Country custCountry = CountryDAO.loadByCountryCode(siteId, form.getCustCountryCode());
    Vector<LabelValueBean> stateVector = new Vector<LabelValueBean>();
    if (custCountry != null) {
      for (State state : custCountry.getStates()) {
        LabelValueBean bean = new LabelValueBean(state.getStateName(), state.getStateCode());
        stateVector.add(bean);
      }
      LabelValueBean states[] = new LabelValueBean[stateVector.size()];
      stateVector.copyInto(states);
         form.setCustStates(states);
    }
    else {
      LabelValueBean states[] = {};
         form.setCustStates(states);
    }
   
    custCountry = CountryDAO.loadByCountryCode(siteId, form.getBillingCustCountryCode());
    stateVector = new Vector<LabelValueBean>();
    if (custCountry != null) {
      for (State state : custCountry.getStates()) {
        LabelValueBean bean = new LabelValueBean(state.getStateName(), state.getStateCode());
        stateVector.add(bean);
      }
      LabelValueBean states[] = new LabelValueBean[stateVector.size()];
      stateVector.copyInto(states);
         form.setBillingCustStates(states);
    }
    else {
      LabelValueBean states[] = {};
         form.setBillingCustStates(states);
    }
   
    custCountry = CountryDAO.loadByCountryCode(siteId, form.getShippingCustCountryCode());
    stateVector = new Vector<LabelValueBean>();
    if (custCountry != null) {
      for (State state : custCountry.getStates()) {
        LabelValueBean bean = new LabelValueBean(state.getStateName(), state.getStateCode());
        stateVector.add(bean);
      }
      LabelValueBean states[] = new LabelValueBean[stateVector.size()];
      stateVector.copyInto(states);
         form.setShippingCustStates(states);
    }
    else {
      LabelValueBean states[] = {};
         form.setShippingCustStates(states);
    }
    }
View Full Code Here

      langTable.put(language.getLangId(), language);
    }
    Language languages[] = new Language[languageVector.size()];
    languageVector.copyInto(languages);

    LabelValueBean beans[] = loadKeyFromProperties();
    englishValues = new Properties();
    for (LabelValueBean bean : beans) {
      englishValues.put(bean.getValue(), bean.getLabel());
    }
View Full Code Here

            value = line.substring(pos + 1);
           
            Iterator<?> iterator = vector.iterator();
            boolean exist = false;
            while (iterator.hasNext()) {
              LabelValueBean b = (LabelValueBean) iterator.next();
              if (b.getLabel().equals(label)) {
                logger.info("Duplicate language key ignored - " + label);
                exist = true;
                break;
              }
            }
            if (exist) {
              continue;
            }
           
              LabelValueBean bean = new LabelValueBean(label, value);
            vector.add(bean);
          }
        }
      }
    LabelValueBean beans[] = new LabelValueBean[vector.size()];
    vector.copyInto(beans);
    return beans;
  }
View Full Code Here

     */
    private void setDropDowns(AddResourcesForm addForm, HttpServletRequest request, Subject subject,
        ResourceCategory category) throws Exception {
        // category drop-down
        for (ResourceCategory nextCategory : ResourceCategory.values()) {
            addForm.addFunction(new LabelValueBean(nextCategory.toString(), nextCategory.name()));
        }

        // type drop-down
        ResourceTypeManagerLocal resourceTypeManager = LookupUtil.getResourceTypeManager();
        List<ResourceType> resourceTypes = resourceTypeManager.getUtilizedResourceTypesByCategory(subject, category,
            null);
        for (ResourceType nextType : resourceTypes) {
            addForm.addType(new LabelValueBean(nextType.getName(), String.valueOf(nextType.getId())));
        }
    }
View Full Code Here

        // Set the first entry in the menu to the label "All <ResourceCategory> Types".
        hubForm.addType(buildResourceTypeMenuCategoryLabel(resourceCategory));
        List<String> resourceTypeNames = resourceTypeManager.getUtilizedResourceTypeNamesByCategory(subject,
            resourceCategory, nameFilter, pluginName);
        for (String resourceTypeName : resourceTypeNames) {
            hubForm.addType(new LabelValueBean(resourceTypeName, encode(resourceTypeName)));
        }

        // Set the first entry in the menu to the label "All Plugins Types"
        hubForm.addPlugin(new LabelValueBean(messages.getMessage("resource.hub.filter.AllPlugins"), ""));
        List<Plugin> plugins = LookupUtil.getPluginManager().getPluginsByResourceTypeAndCategory(typeName,
            resourceCategory);
        for (Plugin plugin : plugins) {
            hubForm.addPlugin(new LabelValueBean(plugin.getDisplayName(), encode(plugin.getName())));
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.struts.util.LabelValueBean

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.