Package pt.webdetails.cdf.dd.model.meta

Examples of pt.webdetails.cdf.dd.model.meta.PropertyType


*/
public class CdeRunJsPropertyTypeWriter extends JsWriterAbstract implements IThingWriter
{
  public void write(Object output, IThingWriteContext context, Thing t) throws ThingWriteException
  {
    PropertyType prop = (PropertyType)t;
    StringBuilder out = (StringBuilder)output;
   
    // ------------
   
    writeValuesListInputTypeRenderer(out, prop);
   
    // ------------
   
    // NOTE: property type name cannot have spaces
    // or other special chars, but this is not enforced anywhere.
   
    String camelName = prop.getCamelName();
   
    // camelName is the name by which the property will be registered
    // on the client, by means of PropertiesManager.register(...)
    String fullName = camelName;
   
    ComponentType owner = prop.getOwner();
    if(owner != null)
    {
      String modelId = CdeRunJsHelper.getComponentTypeModelId(owner);
      fullName = modelId + "_" + fullName;
    }
   
    // PropVar still not garanteed unique...
    String propVarName = prop.getName() + "Property";
   
    // TODO: Currently, the Property/Base property is not being taken
    // into account in the generated JS...
    out.append(NEWLINE);
    out.append("var "); out.append(propVarName); out.append(" = BasePropertyType.extend({");
    out.append(NEWLINE);

    // This is the name used by PropertiesManager.register(...) to index the property
    addJsProperty(out, "type", JsonUtils.toJsString(fullName), INDENT1, true);
    addCommaAndLineSep(out);
   
    out.append(INDENT1); out.append("stub: {"); out.append(NEWLINE);
    // The local property type name is the default name used by property instances
    addJsProperty(out, "name",        JsonUtils.toJsString(camelName), INDENT2, true);
    addJsProperty(out, "value",       prop.getDefaultValue(), INDENT2, false);
    addJsProperty(out, "description", JsonUtils.toJsString(prop.getLabel()), INDENT2, false);
    addJsProperty(out, "tooltip",     JsonUtils.toJsString(prop.getTooltip()), INDENT2, false);
   
    // Unfortunately, this «type» attribute is the InputType...
    // This attribute is stored along with name and value attributes in the CDFDE JSON file.
    addJsProperty(out, "type",        JsonUtils.toJsString(prop.getInputType()), INDENT2, false);
    addJsProperty(out, "order",       String.valueOf(prop.getOrder()), INDENT2, false);
   
    // TODO: CDE editor only supports "simple" and "advanced" classTypes.
    String cat = prop.getCategory();
    if(!PropertyType.CAT_ADVANCED.equals(cat))
    {
      cat = "";
    }
   
View Full Code Here


            }
           
            custPropsElem = implElem.addElement("CustomProperties");
          }

          PropertyType prop = propUsage.getProperty();
          IThingWriter writer;
          try
          {
            writer = factory.getWriter(prop);
          }
View Full Code Here

*/
public class XmlPropertyTypeWriter implements IThingWriter
{
  public void write(java.lang.Object output, IThingWriteContext context, Thing t) throws ThingWriteException
  {
    PropertyType prop = (PropertyType)t;
    Branch parent = (Branch)output; // Element or Document

    boolean isAdvanced = PropertyType.CAT_ADVANCED.equals(prop.getCategory());

    Element propElem = parent.addElement("DesignerProperty");
    Element headerElem = propElem.addElement("Header");

    String defValue = prop.getDefaultValue();
    if("\"\"".equals(defValue))
    {
      defValue = "";
    }
   
    headerElem.addElement("Name").setText(prop.getName());
    headerElem.addElement("Parent").setText(prop.getBase());
    headerElem.addElement("DefaultValue").setText(defValue);
    headerElem.addElement("Description").setText(prop.getLabel());
    headerElem.addElement("Tooltip").setText(prop.getTooltip());
    headerElem.addElement("Advanced").setText(isAdvanced ? "true" : "false");
    headerElem.addElement("InputType").setText(prop.getInputType());
    headerElem.addElement("OutputType").setText(prop.getValueType().toString());
    headerElem.addElement("Order").setText(String.valueOf(prop.getOrder()));
    headerElem.addElement("Version").setText(prop.getVersion());
    headerElem.addElement("Visible").setText(prop.getVisible() ? "true" : "false");
  }
View Full Code Here

      IThingWriterFactory factory = context.getFactory();
      for(PropertyTypeUsage propUsage : comp.getPropertyUsages())
      {
        if(propUsage.isOwned())
        {
          PropertyType prop = propUsage.getProperty();
          IThingWriter writer;
          try
          {
            writer = factory.getWriter(prop);
          }
View Full Code Here

  private ExtensionPropertyBinding(Builder builder, Component owner, MetaModel metaModel) throws ValidationException
  {
    super(builder, owner, metaModel);
   
    PropertyType prop = builder._prop;
    if(prop == null)
    {
      throw new ValidationException(new RequiredAttributeError("Property"));
    }

    String alias = builder._alias;
    if(StringUtils.isEmpty(alias)) { alias = prop.getName(); }

    this._alias = alias;
    this._prop  = prop;
  }
View Full Code Here

        return builder.build(owner, metaModel);
      }
     
      // Then try to bind by name to a global property
      PropertyType prop = metaModel.tryGetPropertyType(this._alias);
      if(prop != null)
      {
        ExtensionPropertyBinding.Builder builder = new ExtensionPropertyBinding.Builder();
       
        // HACK: CCC V1 properties must be made to look like when they were defined
View Full Code Here

TOP

Related Classes of pt.webdetails.cdf.dd.model.meta.PropertyType

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.