Announcement Announcement Module
Collapse
No announcement yet.
How to use TigerEnumComboBoxBinder? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use TigerEnumComboBoxBinder?

    Hi, I'm just trying to figure out how to use the TigerEnumComboBoxBinder.

    Added the following to the application context
    Code:
    <bean id="binderSelectionStrategy"
        class="org.springframework.richclient.form.binding.swing.SwingBinderSelectionStrategy">
        <property name="bindersForPropertyTypes">
          <map>
    
    ...
    
    <entry>
              <key>
                <value type="java.lang.Class">java.lang.Enum</value>
              </key>
              <bean class="org.springframework.richclient.form.binding.swing.TigerEnumComboBoxBinder" />
            </entry>
          </map>
        </property>
      </bean>
    In the form I'm adding the enum based property like this.

    Code:
    formBuilder.add("initialState");
    This gives the following exception:
    Code:
    No converter registered to convert from sourceClass 'class config.State' to target class 'class java.lang.String'
    Do I have to register a seperate enum to text converter here?

    Then I've tried to add the enum field using this method:

    Code:
    formBuilder.add(bindingFactory.createBoundComboBox("initialState"));
    This does not produce any exception, but the combo box is not populated with the available enum values (, exept from default value).

    If supply the values to the binding factory like this:
    Code:
    formBuilder.add(bindingFactory.createBoundComboBox("initialState", State.values());
    then the combo box is populated with the enum values, but no i18n support.

    I've probably missed the most obvious part, but please someone guide me in the right direction here...

    Thanks

    Rune

  • #2
    Messed up my config

    Never mind

    Messed up my application context by adding the wrong BinderSelectionStrategy to the application services. Now the binder (and all the others ) are working like a charm.

    If anyone wonders, the enum field should of course be added to the form builder like this:

    Code:
    formBuilder.add("initialState");
    Rune

    Comment

    Working...
    X