Example usage for com.google.gwt.language.client.transliteration.control TransliterationControlOptions newInstance

List of usage examples for com.google.gwt.language.client.transliteration.control TransliterationControlOptions newInstance

Introduction

In this page you can find the example usage for com.google.gwt.language.client.transliteration.control TransliterationControlOptions newInstance.

Prototype

private static native TransliterationControlOptions newInstance(String srcLangCode, JsArrayString destLangCodes,
        boolean transliterationEnabled, String shortcutKey) ;

Source Link

Document

Private method that creates an instance of Options class with given source language and array of destination languages.

Usage

From source file:com.google.gwt.language.sample.hellolanguage.client.TransliterationDemo.java

License:Apache License

/**
 * Initializes the transliteration controls.
 *
 * @param div the div to which language options menu is attached.
 * @param transltextarea the textarea for transliteration
 *///from   www  .j av a2  s.co  m
private void initTransliterationControls(HTML div, TextArea transltextarea) {
    LanguageCode srcLanguage = LanguageCode.ENGLISH;
    LanguageCode[] destLanguages = SupportedDestinationLanguages.ALL.getLanguageCodes();

    TransliterationControlOptions options = TransliterationControlOptions.newInstance(srcLanguage,
            destLanguages, true, "ctrl+g");
    TransliterationControl control = TransliterationControl.newInstance(options);

    control.showControl(div);
    control.makeTransliteratable(transltextarea);

    // TODO: making textarea transliteratable is resizing the textarea. Fix the
    // issue. Currently we have to explicitly resize or specify
    // adjustTextareaStyle = false
    transltextarea.setWidth("500px");
    transltextarea.setHeight("120px");
}