Style Editor: Source Context
Introduction
The Source Context displays the Java source code for the style being edited. (Figure 1) Unlike form components, there is little need for developers to customize style sheets by editing source code. Developers new to Echo may find value in inspecting the code generated by EchoStudio as the developer manipulates the style sheet in the Design Context.
Style Sheet Source Code
The source code generated by EchoStudio can be divided into two sections. First, EchoStudio defines the style constants as public static final class variables of the StyleSheet. Then, EchoStudio uses a static { } block to invoke a private static method that initializes the Styles.
The initialization method sets the properties for each of the styles defined in the Design Context and then notifies the Styles to be immutable.
The initialization method is regenerated as the developer edits the style sheet and the individual styles in the Design Context. Developers should not modify the code in the initialization method because it will be overwritten the next time EchoStudio regenerates it. For this reason, EchoStudio places a warning in the method's JavaDoc comment and collapses the method's contents. To view the contents, click on the arrow toggle to the left of the method's name.
|