Jump to content
We've recently updated our Privacy Statement, available here ×
  • The inheritance tab


    morlandin
    • Edited on:
    • Version: v1.3.1 Product: Jaspersoft® Studio

    Overview

    The tutorial on element attributes offered an introduction to the inheritance mechanism of elements. It's clear that there isn't a limit on how long the inheritance chain can be , and for this reason can be difficult to determine which attributes are inherited, and where they are inherited from.

    The Inheritance Tab

    Most elements have an Inheritance tab, found in the Properties tab. In the Inheritance tab you can find the attributes of the selected element that can be inherited, and the inheritance hierarchy. It also displays the attributes of the styles in the hierarchy, as well as the inheritable default attributes. Each style in the hierarchy of the selected element are displayed with the attributes that can be inherited, the values of those attributes, the values that are inherited, and those that are overridden by other attributes. Overridden attributes are displayed with a black bar on them. The hierarchy is displayed from the upper level to the lower so in the top position there are the attributes of the selected element and in the bottom position there will be the default attributes. 

    1(3).png.c97f4717213500f38cb32c2a3ac07bf1.png

    In the Figure above there is an example of one such Property tab. This is a default report template that comes with Jaspersoft Studio, called "Cherry" or "Cherry Landscape". In this report there are five styles defined, and no defined default style.

    In this example the element "Cherry Title" is selected. In its Inheritance tab we can see the hierarchy.  From there we can see that element inherits only one style, called "Title". From the "Title" style, the attribute inherits other attributes: "Font Name", "Font Size", "Bold" and "Forecolor".  But "Bold" has a black bar on it, indicating that it is overridden by an attribute with the same name defined at an higher level. In fact, the "Bold" attribute is also defined directly by the selected element, and this instance of the attribute takes precedence over every other "Bold" attribute from a higher level. All the other attributes defined by the style "Title" are used to define the element "Cherry Title" because they aren't overridden by attributes with the same name on a higher level. At the bottom are visible the attributes inherited from the default values. The overridden attributes in this case are:

    • Font Name, defined by the style.
    • Bold, defined by the style and also by the element (so even if the element doesn't have a Bold attribute defined the one from the default values will be still overridden by the one in the style).
    • Font Size, defined by the style.
    • Forecolor, defined by the style.
    • Vertical alignment, defined by the element.

    Using this tab makes it easy to see the hierarchy of an element and from which the attributes are inherited.

    Removing an Attribute from the Hierarchy

    Besides viewing the hierarchy, you can use the Inheritance tab for other things. From here, you can remove an attribute from the hierarchy. This can be done by clicking on the remove button, that appears on the left of every removable attribute when the mouse hovers over it. This is shown in the following figure.

    2(2).png.485458338f125761e8fe56d9ca3d6c42.png

    Not all the attributes can be removed. Default attributes are those values inherited when any other value in hierarchy is undefined, so they can't be removed.

    When you remove  an attribute, it is removed  from the element in which it is defined, and the value will be re-inherited from the next  level down where it is defined. 

    Particular caution is needed when an attribute is removed from a style, because this doesn't influence only the selected element, but every element that use that style. Because of this when the user try to remove an attribute from a style a confirmation message is shown, informing on the possible side effects. Anyway when an attribute is removed the undo command (with the shortcut Ctrl+Z) is available to restore it.


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...