Class CompiledObject

    • Method Detail

      • getSimpleType

        public String getSimpleType()
      • setBeanScope

        public void setBeanScope​(BeanScope beanScope)
      • setAddToContainer

        public void setAddToContainer​(boolean addToContainer)
      • isAddToContainer

        public boolean isAddToContainer()
      • isValidID

        public static boolean isValidID​(String id)
      • isOverride

        public boolean isOverride()
        True if this object overrides an object in the superclass of the class being compiled. For this to be true, the class currently being compiled must be a subclass of another JAXXObject which has an identically-named object.
        Returns:
        true if this object is an override
        See Also:
        setOverride(boolean)
      • isOverrideType

        public boolean isOverrideType()
        true when overrides an object in the superclass of the class being compiled AND type is also override.
        Returns:
        true if this object is an override AND override type
      • setOverride

        public void setOverride​(boolean override)
        Sets whether this class overrides an identically-named object in the parent class.
        Parameters:
        override - true if this object is an override
        See Also:
        isOverride()
      • setSimpleType

        public void setSimpleType​(String simpleType)
        Sets the simple type of the object. Used when castin an overridden object.
        Parameters:
        simpleType - the simple type to use (or the fqn if there is a conflict with already imported types of the compiler).
        Since:
        2.4
      • getStyleClass

        public String getStyleClass()
        Returns this object's CSS style class.
        Returns:
        the value of the styleClass attribute
      • getStyleClasses

        public Set<String> getStyleClasses()
      • matchStyleClass

        public boolean matchStyleClass​(String styleClass)
      • setStyleClass

        public void setStyleClass​(String styleClass)
        Sets this object's CSS style class.
        Parameters:
        styleClass - the new style class
      • getParent

        public CompiledObject getParent()
        Returns this object's parent container. Non-visual components (and the root container) return null.
        Returns:
        the object's parent container
      • getCreationMethodName

        public String getCreationMethodName()
        Returns the name of the method that should be generated in the compiled .java file in order to create this object. This is just a suggestion and may be ignored.
        Returns:
        the suggested name of the method which initializes this object
      • getAdditionMethodName

        public String getAdditionMethodName()
        Returns the name of the method that should be generated in the compiled .java file in order to add children to this object. This is just a suggestion and may be ignored.
        Returns:
        the suggested name of the method which completes this object's setup
      • getObjectClass

        public ClassDescriptor getObjectClass()
        Returns the type of this object.
        Returns:
        the class this CompiledObject represents
      • getId

        public String getId()
        Returns this object's id. Generally, a field with this name will be created in the compiled .java file in order to represent this object.
        Returns:
        the id used to refer to this object
      • getJavaCode

        public String getJavaCode()
        Returns Java code used to refer to this object in the compiled Java file. This is usually the same as its id.
        Returns:
        the Java code for this object
      • getJavaCodeForProperty

        public String getJavaCodeForProperty​(String property)
      • getConstructorParams

        public String getConstructorParams()
        Returns a list of comma-separated Java code snippets that represent the parameters to pass to this object's constructor.
        Returns:
        the raw constructor params
        See Also:
        setConstructorParams(String)
      • setConstructorParams

        public void setConstructorParams​(String constructorParams)
        Sets the parameters to pass to this object's constructor.
        Parameters:
        constructorParams - comma-separated Java code snippets representing constructor params
        See Also:
        getConstructorParams()
      • getInitializer

        public String getInitializer()
      • setInitializer

        public void setInitializer​(String initializer)
      • getInitializationCode

        public String getInitializationCode​(JAXXCompiler compiler)
        Returns the code that performs basic initialization of this object, after it has already been constructed. This basic code should not reference any other CompiledObjects as they may not have been created yet.
        Parameters:
        compiler - compiler to use
        Returns:
        the code which initializes this object
      • getAdditionCode

        public String getAdditionCode()
        Returns Java code to complete final setup on this object. This code may reference other CompiledObjects, as they are guaranteed to have all been created by this point.
        Returns:
        code which adds children and performs final setup
      • appendInitializationCode

        public void appendInitializationCode​(String code)
        Appends code to the initialization code block. A line separator is automatically appended to the end.
        Parameters:
        code - the code to add to the initialization block
        See Also:
        getInitializationCode(JAXXCompiler)
      • appendAdditionCode

        public void appendAdditionCode​(String code)
        Appends code to the addition code block. A line separator is automatically appended to the end.
        Parameters:
        code - the code to add to the addition block
        See Also:
        getAdditionCode()
      • addProperty

        public void addProperty​(String property,
                                String value)
        Stores a property for this object. The only effect of calling this method is that the property will be returned by getProperties().
        Parameters:
        property - the name of the property
        value - the property's value
        See Also:
        getProperties()
      • hasClientProperties

        public boolean hasClientProperties()
      • addClientProperty

        public void addClientProperty​(String property,
                                      String value)
      • getClientProperty

        public String getClientProperty​(String key)
      • getProperties

        public Map<?,​?> getProperties()
        Returns all properties which have been set for this object.
        Returns:
        a Map containing all properties defined for this object
        See Also:
        addProperty(String, String)
      • addEventHandler

        public void addEventHandler​(String eventId,
                                    MethodDescriptor addMethod,
                                    MethodDescriptor listenerMethod,
                                    String code,
                                    JAXXCompiler compiler)
        Adds an event listener to this object. The generated code will appear in the initialization block.
        Parameters:
        eventId - unique (per CompiledObject) identifier for the event handler
        addMethod - the method which adds the event listener
        listenerMethod - the method (in the listener class) which is called when the event is fired
        code - the Java code for the listenerMethod's body
        compiler - the current JAXXCompiler
        See Also:
        getInitializationCode(EventHandler, JAXXCompiler)
      • addChild

        public void addChild​(CompiledObject child,
                             String constraints,
                             JAXXCompiler compiler)
                      throws CompilerException
        Adds a child component to this container. This variant allows the Java code for a layout constraints object to be specified.
        Parameters:
        child - the component to add
        constraints - Java code for the layout constraints object
        compiler - the current JAXXCompiler
        Throws:
        CompilerException - if this object is not a container
      • addChild

        public void addChild​(CompiledObject child,
                             String constraints,
                             JAXXCompiler compiler,
                             DefaultComponentHandler tagHandler)
                      throws CompilerException
        Adds a child component to this container. This variant allows the Java code for a layout constraints object to be specified.
        Parameters:
        child - the component to add
        constraints - Java code for the layout constraints object
        compiler - the current JAXXCompiler
        tagHandler - parent tag handler
        Throws:
        CompilerException - if this object is not a container
      • getGenericTypes

        public String getGenericTypes()
      • setGenericTypes

        public void setGenericTypes​(String... genericTypes)
      • isJavaBean

        public boolean isJavaBean()
      • setJavaBean

        public void setJavaBean​(boolean javaBean)
      • setOverrideType

        public void setOverrideType​(ClassDescriptor overrideType)
      • getJavaBeanInitCode

        public String getJavaBeanInitCode()
      • setJavaBeanInitCode

        public void setJavaBeanInitCode​(String javaBeanInitCode)
      • finalizeCompiler

        public void finalizeCompiler​(JAXXCompiler compiler)
      • getGenericTypesLength

        public int getGenericTypesLength()
      • getGetterName

        public String getGetterName()
      • getSetterName

        public String getSetterName()
      • isUseComputeI18n

        public boolean isUseComputeI18n()
      • getI18nProperty

        public String getI18nProperty()
      • setI18nProperty

        public void setI18nProperty​(String i18nProperty)