Home | History | Annotate | Download | only in openwnn
      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;
     18 
     19 import android.view.View;
     20 import android.content.SharedPreferences;
     21 
     22 /**
     23  * The interface of candidates view manager used by {@link OpenWnn}.
     24  *
     25  * @author Copyright (C) 2008, 2009 OMRON SOFTWARE CO., LTD.  All Rights Reserved.
     26  */
     27 public interface CandidatesViewManager {
     28     /** Size of candidates view (normal) */
     29     public static final int VIEW_TYPE_NORMAL = 0;
     30     /** Size of candidates view (full) */
     31     public static final int VIEW_TYPE_FULL   = 1;
     32     /** Size of candidates view (close/non-display) */
     33     public static final int VIEW_TYPE_CLOSE  = 2;
     34 
     35     /**
     36      * Attribute of a word (no attribute)
     37      * @see jp.co.omronsoft.openwnn.WnnWord
     38      */
     39     public static final int ATTRIBUTE_NONE    = 0;
     40     /**
     41      * Attribute of a word (a candidate in the history list)
     42      * @see jp.co.omronsoft.openwnn.WnnWord
     43      */
     44     public static final int ATTRIBUTE_HISTORY = 1;
     45     /**
     46      * Attribute of a word (the best candidate)
     47      * @see jp.co.omronsoft.openwnn.WnnWord
     48      */
     49     public static final int ATTRIBUTE_BEST    = 2;
     50     /**
     51      * Attribute of a word (auto generated/not in the dictionary)
     52      * @see jp.co.omronsoft.openwnn.WnnWord
     53      */
     54     public static final int ATTRIBUTE_AUTO_GENERATED  = 4;
     55 
     56     /**
     57      * Initialize the candidates view.
     58      *
     59      * @param parent    The OpenWnn object
     60      * @param width     The width of the display
     61      * @param height    The height of the display
     62      *
     63      * @return The candidates view created in the initialize process; {@code null} if cannot create a candidates view.
     64      */
     65     public View initView(OpenWnn parent, int width, int height);
     66 
     67     /**
     68      * Get the candidates view being used currently.
     69      *
     70      * @return The candidates view; {@code null} if no candidates view is used currently.
     71      */
     72     public View getCurrentView();
     73 
     74     /**
     75      * Set the candidates view type.
     76      *
     77      * @param type  The candidate view type
     78      */
     79     public void setViewType(int type);
     80 
     81     /**
     82      * Get the candidates view type.
     83      *
     84      * @return      The view type
     85      */
     86     public int getViewType();
     87 
     88     /**
     89      * Display candidates.
     90      *
     91      * @param converter  The {@link WnnEngine} from which {@link CandidatesViewManager} gets the candidates
     92      *
     93      * @see jp.co.omronsoft.openwnn.WnnEngine#getNextCandidate
     94      */
     95     public void displayCandidates(WnnEngine converter);
     96 
     97     /**
     98      * Clear and hide the candidates view.
     99      */
    100     public void clearCandidates();
    101 
    102     /**
    103      * Reflect the preferences in the candidates view.
    104      *
    105      * @param pref    The preferences
    106      */
    107     public void setPreferences(SharedPreferences pref);
    108 }
    109