Home
Categories
Dictionary
Download
Project Details
Changes Log
Who We Are
FAQ
License

Synth2 Look and Feel


    1  File format and supported properties
    2  Structure
       2.1  Global properties
          2.1.1  Example
       2.2  Constants
          2.2.1  Example
       2.3  Resources
          2.3.1  Example
       2.4  Styles Definition
          2.4.1  Definition of the style and bind elements
    3  See also

The Synth2 Look and Feel is a Swing Look and Feel which can be configured through an XML file. This Look and Feel is specific to the J661 Server, and is derived from the Swing synth Look and Feel.

File format and supported properties

See the Synth2 File format. See the Synth2 components XML properties.

Structure

The synth2 XML configuration file is composed by the following top-level nodes:
  • Global properties
  • Constants
  • Resources
  • Styles definitions: defines how widgets should be presented, depending on their StyleSet

Global properties

The "globalProperty" element allows to define several global properties which will be used for all components. The supported properties are:
  • "grayScaleBrighten": indicates that gray-scaled colors or textures should be brightened
  • "grayScalePercent": indicates the percentage of brightening of gray-scaled colors or textures
  • "labelsEllipsis": indicates if an ellipsis ("..." characters) should be presented for Strings which are wider than their box. Default is true, if false labels will just be clipped inside their box
  • "grayScalePercent": indicates the percentage of brightening of gray-scaled colors or textures
  • "locale": the locale to use for decimals, will change the way the separator is presented
  • "labelsShadowType": true if shadows around elements which have an Haloing should be simple. If this is true, it is a simple offset, if false, this is an offset in all directions (better looking but more resource-consuming)
  • "labelsShadowOffset": the offset in pixels for the shadows around elements which have an Haloing
  • "labelsTextLayoutRendering": true if ALL labels have to be printed as layouts (using the TextLayout class) rather than with the simpler drawString() Graphics2D method

Example

      <globalProperty key="labelsEllipsis" value="false"/>

Constants

Constants can be of the following types:
  • A Color. The Color value can be defined as:
    • A Color value defined as an HTML representation: "#FF00FF". The representation can handle the alpha component for the Color
    • The "transparent" value, meaning that there is no Color
    • A Java Color name, for example "RED" means the RED Color
    • A Color constant
  • A Float value
  • An Integer value. The value can be defined as a valid int String representation, or it can use the "!" sign to shift the value bits to the left. For example, "1 ! 2" means 1 << 2, which is 4

Example

      <constant key="AMBER" value="#FFC700" type="color"/>
      <constant key="FRAMED" value="1 ! 4" />

Resources

Resources can be fonts or image paths.

Example

      <resource key="MyMediumLargeFont" value="Mediumlarge.ttf" type="font"/>

Styles Definition

The definition for the Look for one component is itself composed of two consecutive elements
  • "style": The style and the associated look properties
  • "bind": The binding to the Swing component UI


For example:
      <style id="line">
         <state styleSet="0">
            <stroke width="2" endCap="CAP_ROUND" />
            <property key="graphicWidget.halo" type="boolean" value="false" />
            <property key="halo" type="string" value="supersmall" />
         </state>
      </style>
      <bind style="line" key="line"/>

Definition of the style and bind elements

  • The "style" element defines the properties for each of the StyleSets for a widget. Note that this element does not define the widget name nor its associated Swing component, which will be specified in the consecutive "bind" element
  • The "bind" element binds the style with its specified id to a component
See the Synth2 Look and Feel configuration bindings for the syntax of these elements.

See also


Categories: lookandfeel | server | swing | user

Copyright 2016-2017 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v2 licence