JSWindows (a JavaScript Inheritance Demo) Library Data

© 2013, Martin Rinehart

To understand the library data, you must understand the order of creation of element's styles. It is:

  1. Borders
    1. Borders defaults
    2. Borders specifications
  2. Wobj
    1. Wobj defaults
    2. Wobj specifications
  3. Class ('Class' is one of 'Btn', 'Rect', etc.)
    1. Class defaults
    2. Class specifications

The Styles Cascade

The Borders Data

The Borders object is the first of the last three, optional arguments to the Wobj constructor. If omitted, the object's borders will be created from a default Borders object. If a number is supplied, it will specify the border widths (all four, in pixels) and the style and color will be Borders defaults. A Borders instance may also be passed, specifying width, style and color.

The Wobj Data

The classes that inherit from Wobj inherit their styles from the Wobj defaults. These are overridden by the styles object (if any) passed to the Wobj constructor. The class-specific styles are passed to the Wobj constructor, containing both class defaults and class specifications.

The Class-Specific Data

The class (e.g., Btn or Rect) styles are prepared by starting with the class defaults and then overriding these with the styles specified in the styles object passed to the class constructor. This combination is passed as the styles object for the Wobj constructor.

The Data Cascade

The SKIN Object

The object jsw.SKIN contains the common colors used by the other elements. It's goal is to have a single object that specifies a combination of colors giving an attractive and distinctive look to a JSWindows (a JavaScript Inheritance Demo) application. The names (e.g., background_lite and background_dark) are self-descriptive. A more detailed skin can be provided by adding to the properties of this object and using the additions in the CONSTANTS and styles objects.

The CONSTANTS Object

JavaScript does not have constants, of course. The name of this object is intended to persuade maintenance programmers that these values are not to be changed. The CONSTANTS should provide all values that will be used to create the styles.

The styles Object

All default styles should be provided in this object. For example, jsw.styles.Rect should contain the set of styles that will be available when a default Rect is created. (These styles can be overridden by those specified in the styles argument to the Rect constructor.


Feedback: MartinRinehart at gmail dot com

# # #