Home | History | Annotate | Download | only in EN
      1 /*
      2  * Copyright (C) 2008,2009  OMRON SOFTWARE Co., Ltd.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package jp.co.omronsoft.openwnn.EN;
     18 
     19 import jp.co.omronsoft.openwnn.*;
     20 import android.view.View;
     21 import android.view.Window;
     22 import java.util.Comparator;
     23 
     24 /**
     25  * The user dictionary tool class for English IME.
     26  *
     27  * @author Copyright (C) 2009 OMRON SOFTWARE CO., LTD.  All Rights Reserved.
     28  */
     29 public class UserDictionaryToolsListEN extends UserDictionaryToolsList {
     30     /**
     31      * Constructor
     32      */
     33     public UserDictionaryToolsListEN() {
     34 		if (OpenWnnEN.getInstance() == null) {
     35 			new OpenWnnEN(this);
     36 		}
     37         mListViewName = "jp.co.omronsoft.openwnn.EN.UserDictionaryToolsListEN";
     38         mEditViewName = "jp.co.omronsoft.openwnn.EN.UserDictionaryToolsEditEN";
     39         mPackageName  = "jp.co.omronsoft.openwnn";
     40     }
     41 
     42     /** @see jp.co.omronsoft.openwnn.UserDictionaryToolsList#headerCreate */
     43     @Override protected void headerCreate() {
     44       getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
     45       R.layout.user_dictionary_tools_list_header);
     46     }
     47 
     48     /** @see jp.co.omronsoft.openwnn.UserDictionaryToolsList#createUserDictionaryToolsEdit */
     49     @Override protected UserDictionaryToolsEdit createUserDictionaryToolsEdit(View view1, View view2) {
     50         return new UserDictionaryToolsEditEN(view1, view2);
     51     }
     52 
     53     /** @see jp.co.omronsoft.openwnn.UserDictionaryToolsList#sendEventToIME */
     54     @Override protected boolean sendEventToIME(OpenWnnEvent ev) {
     55         try {
     56             return OpenWnnEN.getInstance().onEvent(ev);
     57         } catch (Exception ex) {
     58             /* do nothing if an error occurs */
     59         }
     60         return false;
     61     }
     62 
     63     /** @see jp.co.omronsoft.openwnn.UserDictionaryToolsList#getComparator */
     64     @Override protected Comparator<WnnWord> getComparator() {
     65     	return new ListComparatorEN();
     66     }
     67 
     68     /** Comparator class for sorting the list of English user dictionary */
     69     protected class ListComparatorEN implements Comparator<WnnWord>{
     70         public int compare(WnnWord word1, WnnWord word2) {
     71             return word1.stroke.compareTo(word2.stroke);
     72         };
     73     }
     74 }
     75