FEST

Problems with French keyboard

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: FEST-Swing 1.2a3
  • Fix Version/s: FEST-Swing 1.2a4
  • Component/s: Swing
  • Labels:
    None
  • Environment:
    Windows XP professional
  • Number of attachments :
    0

Description

Hi,
I have detected a bug with French keyboard when we use methods like enterText().
Indeed, for example, when we type enterText("1234"), the IHM display "&é"'(".
I have searched in the source code and found the problem.
It is caused by the KeyStrokeMappingProviderPicker class.
It always return the English map and the French map is not yet implemented.
But I have found as well that it was'nt useful to create a French map because when the map is empty, display is good.
(I have just test it on windows XP and not on Linux)

I propose those modifications :

In class KeyStrokeMappingProviderPicker:

if(locale.getDefault().equals(Locale.ENGLISH)){
                  return new KeyStrokeMappingProvider_en();
          }else if(locale.equals(Locale.FRANCE)){
                  return new KeyStrokeMappingProvider_fr();
          }else{
                  return new KeyStrokeMappingProvider_en();
          }

Add a new class KeyStrokeMappingProvider_fr

public class KeyStrokeMappingProvider_fr implements KeyStrokeMappingProvider {

  /**
   * Returns the mapping between characters and <code>{@link KeyStroke} </code>s for locale 
   * <code>{@link java.util.Locale#FRENCH FRENCH}</code>.
   * @return the mapping between characters and <code>KeyStroke</code>s for locale <code>FRENCH</code>.
   */
  public Collection<KeyStrokeMapping> keyStrokeMappings() {
    List<KeyStrokeMapping> mappings = new ArrayList<KeyStrokeMapping>(0);
    return mappings;
  }

}

Thanks for your reading.

Cheers

Florian

Activity

Hide
Alex Ruiz added a comment -

From Florian:

I have tested my solution on another pc and found that sometime the problem reappears.

I have made the following modifications :

public class KeyStrokeMappingProvider_fr implements KeyStrokeMappingProvider {

 

  /**

   * Returns the mapping between characters and <code>{@link KeyStroke} </code>s for locale 

   * <code>{@link java.util.Locale#FRENCH FRENCH}</code>.

   * @return the mapping between characters and <code>KeyStroke</code>s for locale <code>FRENCH</code>.

   */

  public Collection<KeyStrokeMapping> keyStrokeMappings() {

    List<KeyStrokeMapping> mappings = new ArrayList<KeyStrokeMapping>(10);

 

    mappings.add(mapping('1', VK_1, SHIFT_MASK));

    mappings.add(mapping('2', VK_2, SHIFT_MASK));

    mappings.add(mapping('3', VK_3, SHIFT_MASK));

    mappings.add(mapping('4', VK_4, SHIFT_MASK));

    mappings.add(mapping('5', VK_5, SHIFT_MASK));

    mappings.add(mapping('6', VK_6, SHIFT_MASK));

    mappings.add(mapping('7', VK_7, SHIFT_MASK));

    mappings.add(mapping('8', VK_8, SHIFT_MASK));

    mappings.add(mapping('9', VK_9, SHIFT_MASK));

    mappings.add(mapping('0', VK_0, SHIFT_MASK));

    return mappings;

  }

}
Show
Alex Ruiz added a comment - From Florian: I have tested my solution on another pc and found that sometime the problem reappears. I have made the following modifications :
public class KeyStrokeMappingProvider_fr implements KeyStrokeMappingProvider {

 

  /**

   * Returns the mapping between characters and <code>{@link KeyStroke} </code>s for locale 

   * <code>{@link java.util.Locale#FRENCH FRENCH}</code>.

   * @return the mapping between characters and <code>KeyStroke</code>s for locale <code>FRENCH</code>.

   */

  public Collection<KeyStrokeMapping> keyStrokeMappings() {

    List<KeyStrokeMapping> mappings = new ArrayList<KeyStrokeMapping>(10);

 

    mappings.add(mapping('1', VK_1, SHIFT_MASK));

    mappings.add(mapping('2', VK_2, SHIFT_MASK));

    mappings.add(mapping('3', VK_3, SHIFT_MASK));

    mappings.add(mapping('4', VK_4, SHIFT_MASK));

    mappings.add(mapping('5', VK_5, SHIFT_MASK));

    mappings.add(mapping('6', VK_6, SHIFT_MASK));

    mappings.add(mapping('7', VK_7, SHIFT_MASK));

    mappings.add(mapping('8', VK_8, SHIFT_MASK));

    mappings.add(mapping('9', VK_9, SHIFT_MASK));

    mappings.add(mapping('0', VK_0, SHIFT_MASK));

    return mappings;

  }

}
Hide
Olivier DOREMIEUX added a comment -

Using : pressAndReleaseKey(KeyPressInfo.keyCode(KeyEvent.VK_A));
Print the letter Q
A French keyboard is azertyuiop, the us keyboard is qwertyuiop

Thanks,

Olivier

Show
Olivier DOREMIEUX added a comment - Using : pressAndReleaseKey(KeyPressInfo.keyCode(KeyEvent.VK_A)); Print the letter Q A French keyboard is azertyuiop, the us keyboard is qwertyuiop Thanks, Olivier
Hide
Alex Ruiz added a comment -

I'll be using this image http://www.forlang.wsu.edu/help/kfrench.asp as reference.

Show
Alex Ruiz added a comment - I'll be using this image http://www.forlang.wsu.edu/help/kfrench.asp as reference.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: