Hi there,

I'm a new SwixML user and would like to submit
a proposal.

The Need:
========

Looking at how the StringConverter classes localizes
attribute values using essentially a properties file, it
seems to me it would be useful if we could extend this
model so that *all* attribute values could be indirected,
when necessary.

In the following snippet ...

<frame name="mainframe"
      size="640,480"
      title="S W I X M L"
      defaultCloseOperation="JFrame.EXIT_ON_CLOSE"
      defaultLookAndFeelDecorated="true"
      bundle="ui.locale.swix">

 <menubar name="menubar">
   <menu name="filemenu" text="mus_File" font="SansSerif--12">
     <menuitem name="mi_new"
               text="mus_New"                      font="SansSerif--12"
               icon="ui/icons/new.gif"
               mnemonic="VK_N"
               accelerator="control N"
               action="newAction"    />

...the font attribute assignment (font="SansSerif--12")
will likely be sprinkled liberally elsewhere across the
file.  If I change that font value in one place, I will
likely need to change the other font values elsewhere
in the file, also.  So you can see a basic need for
indirection: I need a central place to be able to assign
font values to a whole bunch of components.

Besides fonts, other component attributes might need
to be centralized in one place (e.g. the background
color).

The Problem:
==========

I *could* try...

<frame name="mainframe"
      size="640,480"
      title="S W I X M L"
      defaultCloseOperation="JFrame.EXIT_ON_CLOSE"
      defaultLookAndFeelDecorated="true"
      bundle="ui.locale.swix">

 <menubar name="menubar">
   <menu name="filemenu" text="mus_File" font="menu.font">
     <menuitem name="mi_new"
               text="mus_New"                      font="menu.font"
               icon="ui/icons/new.gif"
               mnemonic="VK_N"
               accelerator="control N"
               action="newAction"    />

...with...

menu.font = SansSerif--12

...defined in the swix.properties file.

This wont work of course, because only StringConverter
applies the PropertyResourceBundle to the parsed attribute
values.


Proposal:
=======

If an attribute value starts with an escape character, say '@'
(perhaps with '@@' escaping itself), then the *parser*--not the
converter, attempts to "localize" the XML attribute value before
passing it off to the converter.

Alternatively, we could forget about the special escape character
and attempt to "localize" all attribute values, willy nilly.  Personally,
I'm not for this: it would be better to make the indirection more
explicit: right now, in order to see if a string is localized, you have
to check the properties file; you can't tell just from looking at the
XML.

What do you think?

-Babak

_______________________________________________
Forum mailing list
Forum@carlsbadcubes.com
http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
  • [Forum] XML at... List for Users of Carlsbad Cubes' Technologies and Products
    • Re: [Foru... List for Users of Carlsbad Cubes' Technologies and Products
      • Re: [... List for Users of Carlsbad Cubes' Technologies and Products
    • Re: [Foru... List for Users of Carlsbad Cubes' Technologies and Products
      • Re: [... List for Users of Carlsbad Cubes' Technologies and Products
        • R... List for Users of Carlsbad Cubes' Technologies and Products
          • ... List for Users of Carlsbad Cubes' Technologies and Products
            • ... List for Users of Carlsbad Cubes' Technologies and Products
    • Re: [Foru... List for Users of Carlsbad Cubes' Technologies and Products
      • Re: [... List for Users of Carlsbad Cubes' Technologies and Products

Reply via email to