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.JAJP; 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 Japanese IME. 26 * 27 * @author Copyright (C) 2009 OMRON SOFTWARE CO., LTD. All Rights Reserved. 28 */ 29 public class UserDictionaryToolsListJAJP extends UserDictionaryToolsList { 30 /** 31 * Constructor 32 */ 33 public UserDictionaryToolsListJAJP() { 34 mListViewName = "jp.co.omronsoft.openwnn.JAJP.UserDictionaryToolsListJAJP"; 35 mEditViewName = "jp.co.omronsoft.openwnn.JAJP.UserDictionaryToolsEditJAJP"; 36 mPackageName = "jp.co.omronsoft.openwnn"; 37 } 38 39 /** @see jp.co.omronsoft.openwnn.UserDictionaryToolsList#headerCreate */ 40 @Override protected void headerCreate() { 41 getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, 42 R.layout.user_dictionary_tools_list_header_ja); 43 } 44 45 /** @see jp.co.omronsoft.openwnn.UserDictionaryToolsList#createUserDictionaryToolsEdit */ 46 @Override protected UserDictionaryToolsEdit createUserDictionaryToolsEdit(View view1, View view2) { 47 return new UserDictionaryToolsEditJAJP(view1, view2); 48 } 49 50 /** @see jp.co.omronsoft.openwnn.UserDictionaryToolsList#sendEventToIME */ 51 @Override protected boolean sendEventToIME(OpenWnnEvent ev) { 52 try { 53 return OpenWnnJAJP.getInstance().onEvent(ev); 54 } catch (Exception ex) { 55 /* do nothing if an error occurs */ 56 } 57 return false; 58 } 59 60 /** @see jp.co.omronsoft.openwnn.UserDictionaryToolsList#getComparator */ 61 @Override protected Comparator<WnnWord> getComparator() { 62 return new ListComparatorJAJP(); 63 } 64 65 /** Comparator class for sorting the list of Japanese user dictionary */ 66 protected class ListComparatorJAJP implements Comparator<WnnWord>{ 67 public int compare(WnnWord word1, WnnWord word2) { 68 return word1.stroke.compareTo(word2.stroke); 69 }; 70 } 71 } 72