Package org.infoglue.deliver.applications.databeans

Examples of org.infoglue.deliver.applications.databeans.ComponentPropertyOption


    List authorizedContentTypeDefinitionVOList = ContentTypeDefinitionController.getController().getSortedAuthorizedContentTypeDefinitionVOList(principal, db);
    Iterator authorizedContentTypeDefinitionVOListIterator = authorizedContentTypeDefinitionVOList.iterator();
    while(authorizedContentTypeDefinitionVOListIterator.hasNext())
    {
      ContentTypeDefinitionVO contentTypeDefinitionVO = (ContentTypeDefinitionVO)authorizedContentTypeDefinitionVOListIterator.next();
      ComponentPropertyOption option = new ComponentPropertyOption();
      option.setName(contentTypeDefinitionVO.getName());
      option.setValue(contentTypeDefinitionVO.getId().toString());
      options.add(option);
    }
   
    return options;
  }
View Full Code Here


      Iterator propertiesIterator = properties.iterator();
      while(propertiesIterator.hasNext())
      {
        Element propertyElement = (Element)propertiesIterator.next();
        logger.info("propertyElement:" + propertyElement);
        ComponentPropertyOption option = new ComponentPropertyOption();
        if(propertyElement.attributeValue("name_" + languageCode) != null && !propertyElement.attributeValue("name_" + languageCode).equals(""))
          option.setName(propertyElement.attributeValue("name_" + languageCode));
        else
          option.setName(propertyElement.attributeValue("name"));
       
        option.setValue(propertyElement.attributeValue("value"));
        options.add(option);
      }

      if(options != null)
            CacheController.cacheObjectInAdvancedCache("propertyOptionsCache", "properties_" + serviceUrl + "_" + charset, options);
View Full Code Here

            while(optionListIterator.hasNext())
            {
              Element option = (Element)optionListIterator.next();
              String optionName  = option.attributeValue("name");
              String optionValue  = option.attributeValue("value");
              ComponentPropertyOption cpo = new ComponentPropertyOption(optionName, optionValue);
              property.getOptions().add(cpo);
            }
           
            //logger.info("value:" + value);
            property.setValue(value);
          }
          else if(type.equalsIgnoreCase(ComponentProperty.CHECKBOXFIELD)) 
          {   
            String value = getComponentPropertyValue(componentId, name, property.getAllowLanguageVariations());
            String allowMultipleSelections = binding.attributeValue("allowMultipleSelections");
            if(allowMultipleSelections != null && allowMultipleSelections.equalsIgnoreCase("true"))
              property.setAllowMultipleSelections(true);
           
            List optionList = binding.elements("option");
            Iterator optionListIterator = optionList.iterator();
            while(optionListIterator.hasNext())
            {
              Element option = (Element)optionListIterator.next();
              String optionName  = option.attributeValue("name");
              String optionValue  = option.attributeValue("value");
              ComponentPropertyOption cpo = new ComponentPropertyOption(optionName, optionValue);
              property.getOptions().add(cpo);
            }
           
            //logger.info("value:" + value);
            property.setValue(value);
View Full Code Here

    cacheResultProperty.setDataProvider("");
    cacheResultProperty.setType("select");
    cacheResultProperty.setVisualizingAction("");
    cacheResultProperty.setCreateAction("");
   
    ComponentPropertyOption cpoNo = new ComponentPropertyOption("No", "false");
    ComponentPropertyOption cpoYes = new ComponentPropertyOption("Yes", "true");
    cacheResultProperty.getOptions().add(cpoNo);
    cacheResultProperty.getOptions().add(cpoYes);
     
    String value = getComponentPropertyValue(componentId, "CacheResult", cacheResultProperty.getAllowLanguageVariations());
    cacheResultProperty.setValue(value);
   
    componentProperties.add(cacheResultProperty);

    ComponentProperty cacheIntervalProperty = new ComponentProperty();
    cacheIntervalProperty.setComponentId(componentId);
    cacheIntervalProperty.setName("UpdateInterval");
    cacheIntervalProperty.setDisplayName("Cache Update Interval");
    cacheIntervalProperty.setDescription("Interval before the cache gets updated");
    cacheIntervalProperty.setDefaultValue("-1");
    cacheIntervalProperty.setAllowLanguageVariations(new Boolean(false));
    cacheIntervalProperty.setDataProvider("");
    cacheIntervalProperty.setType("select");
    cacheIntervalProperty.setVisualizingAction("");
    cacheIntervalProperty.setCreateAction("");
   
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("1 second", "1"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("2 seconds", "2"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("3 seconds", "3"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("4 seconds", "4"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("5 seconds", "5"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("10 seconds", "10"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("15 seconds", "15"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("20 seconds", "20"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("30 seconds", "30"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("1 minute", "60"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("2 minutes", "120"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("5 minutes", "300"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("10 minutes", "600"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("30 minutes", "1800"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("1 hour", "3600"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("2 hours", "7200"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("6 hours", "21600"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("12 hours", "43200"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("24 hours", "86400"));

    String updateIntervalValue = getComponentPropertyValue(componentId, "UpdateInterval", cacheIntervalProperty.getAllowLanguageVariations());
    cacheIntervalProperty.setValue(updateIntervalValue);
   
    componentProperties.add(cacheIntervalProperty);

    ComponentProperty cacheKeyProperty = new ComponentProperty();
    cacheKeyProperty.setComponentId(componentId);
    cacheKeyProperty.setName("CacheKey");
    cacheKeyProperty.setDisplayName("Cache Key");
    cacheKeyProperty.setDescription("Key for the component cache");
    cacheKeyProperty.setDefaultValue("");
    cacheKeyProperty.setAllowLanguageVariations(new Boolean(false));
    cacheKeyProperty.setDataProvider("");
    cacheKeyProperty.setType("textfield");
    cacheKeyProperty.setVisualizingAction("");
    cacheKeyProperty.setCreateAction("");
   
    String cacheKeyValue = getComponentPropertyValue(componentId, "CacheKey", cacheKeyProperty.getAllowLanguageVariations());
    cacheKeyProperty.setValue(cacheKeyValue);
   
    componentProperties.add(cacheKeyProperty);

    ComponentProperty priorityProperty = new ComponentProperty();
    priorityProperty.setComponentId(componentId);
    priorityProperty.setName("PreRenderOrder");
    priorityProperty.setDisplayName("Pre processing order");
    priorityProperty.setDescription("State the order in which the component get's prerendered");
    priorityProperty.setDefaultValue("99");
    priorityProperty.setAllowLanguageVariations(new Boolean(false));
    priorityProperty.setDataProvider("");
    priorityProperty.setType("select");
    priorityProperty.setVisualizingAction("");
    priorityProperty.setCreateAction("");
   
    for(int i=0; i<15; i++)
      priorityProperty.getOptions().add(new ComponentPropertyOption("" + i, "" + i));

    String preRenderOrderPropertyValue = getComponentPropertyValue(componentId, "PreRenderOrder", priorityProperty.getAllowLanguageVariations());
    priorityProperty.setValue(preRenderOrderPropertyValue);
   
    componentProperties.add(priorityProperty);
View Full Code Here

            while(optionListIterator.hasNext())
            {
              Element option = (Element)optionListIterator.next();
              String optionName  = option.attributeValue("name");
              String optionValue  = option.attributeValue("value");
              ComponentPropertyOption cpo = new ComponentPropertyOption(optionName, optionValue);
              property.getOptions().add(cpo);
            }
           
            //logger.info("value:" + value);
            property.setValue(value);
          }
          else if(type.equalsIgnoreCase(ComponentProperty.CHECKBOXFIELD)) 
          {   
            String value = getComponentPropertyValue(componentId, name, templateController, property.getAllowLanguageVariations());
            String allowMultipleSelections = binding.attributeValue("allowMultipleSelections");
            if(allowMultipleSelections != null && allowMultipleSelections.equalsIgnoreCase("true"))
              property.setAllowMultipleSelections(true);
           
            List optionList = binding.elements("option");
            Iterator optionListIterator = optionList.iterator();
            while(optionListIterator.hasNext())
            {
              Element option = (Element)optionListIterator.next();
              String optionName  = option.attributeValue("name");
              String optionValue  = option.attributeValue("value");
              ComponentPropertyOption cpo = new ComponentPropertyOption(optionName, optionValue);
              property.getOptions().add(cpo);
            }
           
            //logger.info("value:" + value);
            property.setValue(value);
View Full Code Here

              }
              catch (Exception e)
              {
                logger.warn("A problem loading the data provider for property " + componentProperty.getName() + ":" + e.getMessage(), e);
                List<ComponentPropertyOption> errorOptions = new ArrayList<ComponentPropertyOption>();
                ComponentPropertyOption componentPropertyOption = new ComponentPropertyOption();
                componentPropertyOption.setName("Error:" + e.getMessage());
                componentPropertyOption.setValue("");
                errorOptions.add(componentPropertyOption);
                optionsIterator = errorOptions.iterator();
              }
            }
           
            String exactMatchOptionName = getExactMatch(componentProperty, options);
           
            //Now let's check for smaller matches
            while(optionsIterator.hasNext())
            {
                ComponentPropertyOption option = (ComponentPropertyOption)optionsIterator.next();
                boolean debug = false;
                if(componentProperty.getName().equalsIgnoreCase("SelectTest"))
                  debug = true;
               
                try
                {
                  boolean isSame = false;
                  if(componentProperty != null && componentProperty.getValue() != null && option != null && option.getValue() != null)
                  {
                    if(exactMatchOptionName != null && option.getName().equals(exactMatchOptionName))
                    {
                      isSame = true;
                    }
                    else if(exactMatchOptionName == null)
                    {
                      //The option values
                      String optionValue = option.getValue();
                      //The saved values
                      String[] values = componentProperty.getValue().split(",");
                      logger.debug("optionValue:" + optionValue);
                      logger.debug("savedValue:" + componentProperty.getValue());
                     
                      int matches = 0;
                      for(int i=0; i<values.length; i++)
                      {
                        String savedValue = values[i];
                        logger.debug("savedValue part:" + savedValue);
                        logger.debug("optionValue:" + optionValue);
                        boolean matchesValue = savedValue.equals(optionValue);
                        if(matchesValue)
                        {
                          isSame = true;
                          logger.debug("Match on individual saved value:" + optionValue);
                          break;
                        }
                      }
                    }
                  }
                 
                  logger.debug("isSame: " + isSame + " : " + option.getValue());
     
                  sb.append("<option value=\"" + option.getValue() + "\"" + (isSame ? " selected=\"1\"" : "") + ">" + option.getName() + "</option>");
                }
                catch (Exception e)
                {
                  logger.error("Error setting picked value:" + e.getMessage(), e);
              }
            }
           
              sb.append("</select></td>");
          }
          else
            sb.append("      <td class=\"igpropertyvalue igpropertyDivider\" align=\"left\">" + componentProperty.getDisplayName() + "</td>");
   
          if(hasAccessToProperty)
            sb.append("      <td class=\"igtd igpropertyDivider\" width=\"16\"><a class=\"componentEditorLink\" href=\"" + componentEditorUrl + "ViewSiteNodePageComponents!deleteComponentPropertyValue.action?siteNodeId=" + siteNodeId + "&languageId=" + languageId + "&contentId=" + contentId + "&componentId=" + componentId + "&propertyName=" + componentProperty.getName() + "&showSimple=" + this.getTemplateController().getDeliveryContext().getShowSimple() + "\"><img src=\"" + componentEditorUrl + "/css/images/delete.gif\" border=\"0\" style='padding-top: 2px;' alt=\"delete\"/></a></td>");
          else
            sb.append("      <td class=\"igtd igpropertyDivider\" width=\"16\"></td>");
         
          sb.append("      <td class=\"igtd igpropertyDivider\" width=\"16\"><img class=\"questionMark\" src=\"" + componentEditorUrl + "/css/images/questionMarkGrad.gif\" onmouseover=\"showDiv('helpLayer" + componentProperty.getComponentId() + "_" + formatter.replaceNonAscii(componentProperty.getName(), "_") + "');\" onmouseout=\"javascript:hideDiv('helpLayer" + componentProperty.getComponentId() + "_" + formatter.replaceNonAscii(componentProperty.getName(), "_") + "');\" alt=\"question\"/>" + helpSB + "</td>");
          sb.append("    </tr>");
         
          if(hasAccessToProperty)
          {
              propertyIndex++;
              accessablePropertyIndex++;
          }
        }
        else if(componentProperty.getType().equalsIgnoreCase(ComponentProperty.CHECKBOXFIELD))
        {
          if(isAdvancedProperties)
            sb.append("  <tr class=\"igtr advancedProperty" + componentId + "\" style='display:none;'>");
          else
            sb.append("  <tr class=\"igtr\">");

          sb.append("      <td class=\"igpropertylabel igpropertyDivider\" valign=\"top\" align=\"left\">" + componentProperty.getDisplayName() + "</td>");
         
          if(hasAccessToProperty)
          {
            sb.append("      <td class=\"igpropertyvalue igpropertyDivider\" align=\"left\"><input type=\"hidden\" name=\"" + propertyIndex + "_propertyName\" value=\"" + componentProperty.getName() + "\"/>");
           
            Iterator optionsIterator = componentProperty.getOptions().iterator();
           
            if(componentProperty.getDataProvider() != null && !componentProperty.getDataProvider().equals(""))
            {
              try
              {
                PropertyOptionsDataProvider provider = (PropertyOptionsDataProvider)Class.forName(componentProperty.getDataProvider()).newInstance();
                logger.info("componentProperty.getDataProviderParameters():" + componentProperty.getDataProviderParameters());
                Map parameters = httpHelper.toMap(componentProperty.getDataProviderParameters(), "UTF-8", ";");
                optionsIterator = provider.getOptions(parameters, locale.getLanguage(), principal, templateController.getDatabase()).iterator();
              }
              catch (Exception e)
              {
                logger.warn("A problem loading the data provider for property " + componentProperty.getName() + ":" + e.getMessage(), e);
                List<ComponentPropertyOption> errorOptions = new ArrayList<ComponentPropertyOption>();
                ComponentPropertyOption componentPropertyOption = new ComponentPropertyOption();
                componentPropertyOption.setName("Error:" + e.getMessage());
                componentPropertyOption.setValue("");
                errorOptions.add(componentPropertyOption);
                optionsIterator = errorOptions.iterator();
              }
            }

            while(optionsIterator.hasNext())
            {
                ComponentPropertyOption option = (ComponentPropertyOption)optionsIterator.next();
                boolean isSame = false;
                if(componentProperty != null && componentProperty.getValue() != null && option != null && option.getValue() != null)
                {
                  String[] values = componentProperty.getValue().split(",");
                  for(int i=0; i<values.length; i++)
                  {
                    isSame = values[i].equals(option.getValue());
                    if(isSame)
                      break;
                  }
                }
 
                sb.append("<input type=\"checkbox\" name=\"" + componentProperty.getName() + "\" value=\"" + option.getValue() + "\"" + (isSame ? " checked=\"1\"" : "") + " onclicked=\"setDirty();\"/>" + option.getName() + " ");
            }
           
              sb.append("</td>");
          }
          else
View Full Code Here

            while(optionListIterator.hasNext())
            {
              Element option = (Element)optionListIterator.next();
              String optionName  = option.attributeValue("name");
              String optionValue  = option.attributeValue("value");
              ComponentPropertyOption cpo = new ComponentPropertyOption();
              cpo.setName(optionName);
              cpo.setValue(optionValue);
              property.getOptions().add(cpo);
            }
           
            //logger.info("value:" + value);
            property.setValue(value);
          }
          else if(type.equalsIgnoreCase(ComponentProperty.CHECKBOXFIELD)) 
          {   
            String value = getComponentPropertyValue(componentId, name, siteNodeId, languageId, contentId, locale, db, principal, property);
            String allowMultipleSelections = binding.attributeValue("allowMultipleSelections");
            if(allowMultipleSelections != null && allowMultipleSelections.equalsIgnoreCase("true"))
              property.setAllowMultipleSelections(true);
           
            List optionList = binding.elements("option");
            Iterator optionListIterator = optionList.iterator();
            while(optionListIterator.hasNext())
            {
              Element option = (Element)optionListIterator.next();
              String optionName  = option.attributeValue("name");
              String optionValue  = option.attributeValue("value");
              ComponentPropertyOption cpo = new ComponentPropertyOption();
              cpo.setName(optionName);
              cpo.setValue(optionValue);
              property.getOptions().add(cpo);
            }
           
            //logger.info("value:" + value);
            property.setValue(value);
View Full Code Here

    cacheResultProperty.setDataProvider("");
    cacheResultProperty.setType("select");
    cacheResultProperty.setVisualizingAction("");
    cacheResultProperty.setCreateAction("");
   
    ComponentPropertyOption cpoNo = new ComponentPropertyOption("No", "false");
    ComponentPropertyOption cpoYes = new ComponentPropertyOption("Yes", "true");
    cacheResultProperty.getOptions().add(cpoNo);
    cacheResultProperty.getOptions().add(cpoYes);
     
    String value = getComponentPropertyValue(componentId, "CacheResult", siteNodeId, languageId, contentId, locale, db, principal, cacheResultProperty);
    cacheResultProperty.setValue(value);
   
    componentProperties.add(cacheResultProperty);

    ComponentProperty cacheIntervalProperty = new ComponentProperty();
    cacheIntervalProperty.setComponentId(componentId);
    cacheIntervalProperty.setName("UpdateInterval");
    cacheIntervalProperty.setDisplayName("Cache Update Interval");
    cacheIntervalProperty.setDescription("Interval before the cache gets updated");
    cacheIntervalProperty.setDefaultValue("-1");
    cacheIntervalProperty.setAllowLanguageVariations(false);
    cacheIntervalProperty.setDataProvider("");
    cacheIntervalProperty.setType("select");
    cacheIntervalProperty.setVisualizingAction("");
    cacheIntervalProperty.setCreateAction("");
   
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("1 second", "1"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("2 seconds", "2"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("3 seconds", "3"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("4 seconds", "4"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("5 seconds", "5"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("10 seconds", "10"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("15 seconds", "15"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("20 seconds", "20"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("30 seconds", "30"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("1 minute", "60"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("2 minutes", "120"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("5 minutes", "300"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("10 minutes", "600"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("30 minutes", "1800"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("1 hour", "3600"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("2 hours", "7200"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("6 hours", "21600"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("12 hours", "43200"));
    cacheIntervalProperty.getOptions().add(new ComponentPropertyOption("24 hours", "86400"));

    String updateIntervalValue = getComponentPropertyValue(componentId, "UpdateInterval", siteNodeId, languageId, contentId, locale, db, principal, cacheIntervalProperty);
    cacheIntervalProperty.setValue(updateIntervalValue);
   
    componentProperties.add(cacheIntervalProperty);

    ComponentProperty cacheKeyProperty = new ComponentProperty();
    cacheKeyProperty.setComponentId(componentId);
    cacheKeyProperty.setName("CacheKey");
    cacheKeyProperty.setDisplayName("Cache Key");
    cacheKeyProperty.setDescription("Key for the component cache");
    cacheKeyProperty.setDefaultValue("");
    cacheKeyProperty.setAllowLanguageVariations(false);
    cacheKeyProperty.setDataProvider("");
    cacheKeyProperty.setType("textfield");
    cacheKeyProperty.setVisualizingAction("");
    cacheKeyProperty.setCreateAction("");
   
    String cacheKeyValue = getComponentPropertyValue(componentId, "CacheKey", siteNodeId, languageId, contentId, locale, db, principal, cacheKeyProperty);
    cacheKeyProperty.setValue(cacheKeyValue);
   
    componentProperties.add(cacheKeyProperty);

    ComponentProperty priorityProperty = new ComponentProperty();
    priorityProperty.setComponentId(componentId);
    priorityProperty.setName("PreRenderOrder");
    priorityProperty.setDisplayName("Pre processing order");
    priorityProperty.setDescription("State the order in which the component get's prerendered");
    priorityProperty.setDefaultValue("99");
    priorityProperty.setAllowLanguageVariations(false);
    priorityProperty.setDataProvider("");
    priorityProperty.setType("select");
    priorityProperty.setVisualizingAction("");
    priorityProperty.setCreateAction("");
   
    for(int i=0; i<15; i++)
      priorityProperty.getOptions().add(new ComponentPropertyOption("" + i, "" + i));

    String preRenderOrderPropertyValue = getComponentPropertyValue(componentId, "PreRenderOrder", siteNodeId, languageId, contentId, locale, db, principal, priorityProperty);
    priorityProperty.setValue(preRenderOrderPropertyValue);
   
    componentProperties.add(priorityProperty);
View Full Code Here

              }
              catch (Exception e)
              {
                logger.warn("A problem loading the data provider for property " + componentProperty.getName() + ":" + e.getMessage(), e);
                List<GenericOptionDefinition> errorOptions = new ArrayList<GenericOptionDefinition>();
                ComponentPropertyOption componentPropertyOption = new ComponentPropertyOption();
                componentPropertyOption.setName("Error:" + e.getMessage());
                componentPropertyOption.setValue("");
                errorOptions.add(componentPropertyOption);
                optionsIterator = errorOptions.iterator();
              }
            }
           
            while(optionsIterator.hasNext())
            {
                ComponentPropertyOption option = (ComponentPropertyOption)optionsIterator.next();
                boolean isSame = false;
                if(componentProperty != null && componentProperty.getValue() != null && option != null && option.getValue() != null)
                  isSame = componentProperty.getValue().equals(option.getValue());
                sb.append("<option value=\"" + option.getValue() + "\"" + (isSame ? " selected=\"1\"" : "") + ">" + option.getName() + "</option>");
            }
           
            sb.append("  </select>");         
          }
          else
            sb.append("  " + componentProperty.getName() + "");
          sb.append("    </div>");
   
          if(hasAccessToProperty)
          {
            sb.append("  <div class=\"actionGroup\">");
            sb.append("  <a class=\"componentEditorLink\" href=\"" + componentEditorUrl + "ViewSiteNodePageComponents!deleteComponentPropertyValue.action?siteNodeId=" + siteNodeId + "&amp;languageId=" + languageId + "&amp;contentId=" + contentId + "&amp;componentId=" + componentId + "&amp;propertyName=" + componentProperty.getName() + "&amp;showSimple=" + showSimple + "\"><img src=\"" + componentEditorUrl + "/css/images/delete.gif\" border=\"0\"/></a>");
            sb.append("  </div>");
          }
          sb.append("  </div>");
       
          sb.append("  </div>");
         
          if(hasAccessToProperty)
              propertyIndex++;
        }
        else if(componentProperty.getType().equalsIgnoreCase(ComponentProperty.CHECKBOXFIELD))
        {
          if(isAdvancedProperties)
            sb.append("  <div class=\"propertyRow advancedProperty" + componentId + "\" style='display:none;'>");
          else
            sb.append("  <div class=\"propertyRow\">");
         
          //sb.append("  <div class=\"propertyRow\">");
          sb.append("    <div class=\"propertyRowLeft\">");
          sb.append("    <label for=\"" + componentProperty.getName() + "\" onMouseOver=\"showDiv('helpLayer" + componentProperty.getComponentId() + "_" + componentProperty.getName() + "');\" onMouseOut=\"javascript:hideDiv('helpLayer" + componentProperty.getComponentId() + "_" + componentProperty.getName() + "');\">" + componentProperty.getDisplayName() + "</label>");
          sb.append("    </div>");
 
          sb.append("    <div class=\"propertyRowRight\">");
          sb.append("      <div class=\"fieldGroup\">");                 
          if(hasAccessToProperty)
          {
            sb.append("    <input type=\"hidden\" name=\"" + propertyIndex + "_propertyName\" value=\"" + componentProperty.getName() + "\">");
            int numberOfCheckboxes = 0;
            Iterator optionsIterator = componentProperty.getOptions().iterator();
           
            if(componentProperty.getDataProvider() != null && !componentProperty.getDataProvider().equals(""))
            {
              try
              {
                PropertyOptionsDataProvider provider = (PropertyOptionsDataProvider)Class.forName(componentProperty.getDataProvider()).newInstance();
                Map parameters = httpHelper.toMap(componentProperty.getDataProviderParameters(), "UTF-8", ";");
                optionsIterator = provider.getOptions(parameters, locale.getLanguage(), principal, db).iterator();
              }
              catch (Exception e)
              {
                logger.warn("A problem loading the data provider for property " + componentProperty.getName() + ":" + e.getMessage(), e);
                List<ComponentPropertyOption> errorOptions = new ArrayList<ComponentPropertyOption>();
                ComponentPropertyOption componentPropertyOption = new ComponentPropertyOption();
                componentPropertyOption.setName("Error:" + e.getMessage());
                componentPropertyOption.setValue("");
                errorOptions.add(componentPropertyOption);
                optionsIterator = errorOptions.iterator();
              }
            }

            while(optionsIterator.hasNext())
            {
                ComponentPropertyOption option = (ComponentPropertyOption)optionsIterator.next();
                boolean isSame = false;
                if(componentProperty != null && componentProperty.getValue() != null && option != null && option.getValue() != null)
                {
                  String[] values = componentProperty.getValue().split(",");
                  for(int i=0; i<values.length; i++)
                  {
                    isSame = values[i].equals(option.getValue());
                    if(isSame)
                      break;
                  }
                }
 
                sb.append("<input type=\"checkbox\" style=\"width: 20px; border: 0px;\" name=\"" + componentProperty.getName() + "\" value=\"" + option.getValue() + "\"" + (isSame ? " checked=\"1\"" : "") + " onclicked=\"setDirty();\"/>" + option.getName() + " ");
                numberOfCheckboxes++;
                if(numberOfCheckboxes == 2)
                {
                  numberOfCheckboxes = 0;
                  //sb.append("<br/>");
View Full Code Here

            while(optionListIterator.hasNext())
            {
              Element option = (Element)optionListIterator.next();
              String optionName  = option.attributeValue("name");
              String optionValue  = option.attributeValue("value");
              ComponentPropertyOption cpo = new ComponentPropertyOption();
              cpo.setName(optionName);
              cpo.setValue(optionValue);
              property.getOptions().add(cpo);
            }
           
            //logger.info("value:" + value);
            property.setValue(value);
          }
          else if(type.equalsIgnoreCase(ComponentProperty.CHECKBOXFIELD)) 
          {   
            String value = getComponentPropertyValue(componentId, name, property.getAllowLanguageVariations());
            timer.printElapsedTime("Set property3");
           
            List optionList = binding.elements("option");
            Iterator optionListIterator = optionList.iterator();
            while(optionListIterator.hasNext())
            {
              Element option = (Element)optionListIterator.next();
              String optionName  = option.attributeValue("name");
              String optionValue  = option.attributeValue("value");
              ComponentPropertyOption cpo = new ComponentPropertyOption();
              cpo.setName(optionName);
              cpo.setValue(optionValue);
              property.getOptions().add(cpo);
            }
           
            //logger.info("value:" + value);
            property.setValue(value);
View Full Code Here

TOP

Related Classes of org.infoglue.deliver.applications.databeans.ComponentPropertyOption

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.