KindSectionView.java revision cfb525b3f18d71d6cc5d4ef36d704b3ba9e9a6f3
1aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey/*
2aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey * Copyright (C) 2009 The Android Open Source Project
3aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey *
4aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey * Licensed under the Apache License, Version 2.0 (the "License");
5aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey * you may not use this file except in compliance with the License.
6aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey * You may obtain a copy of the License at
7aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey *
8aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey *      http://www.apache.org/licenses/LICENSE-2.0
9aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey *
10aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey * Unless required by applicable law or agreed to in writing, software
11aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey * distributed under the License is distributed on an "AS IS" BASIS,
12aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey * See the License for the specific language governing permissions and
14aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey * limitations under the License.
15aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey */
16aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
17afeae64e9a9bb39c918202a5775c4904e2f0d92eDaniel Lehmannpackage com.android.contacts.views.editor;
18aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
19aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkeyimport com.android.contacts.R;
2035769b804fbfd5a1fc0b2c36cd0a786d662c4334Daniel Lehmannimport com.android.contacts.model.BaseAccountType.DataKind;
21d25f958595b190586bd838d50718b1a2a3f0d417Dmitri Plotnikovimport com.android.contacts.model.EntityDelta;
22aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkeyimport com.android.contacts.model.EntityDelta.ValuesDelta;
23d25f958595b190586bd838d50718b1a2a3f0d417Dmitri Plotnikovimport com.android.contacts.model.EntityModifier;
24afeae64e9a9bb39c918202a5775c4904e2f0d92eDaniel Lehmannimport com.android.contacts.views.editor.Editor.EditorListener;
25aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
26aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkeyimport android.content.Context;
27aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkeyimport android.provider.ContactsContract.Data;
283e7436450f0fdd5ad939c3b46e7176e082c9ee11Daniel Lehmannimport android.text.TextUtils;
29aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkeyimport android.util.AttributeSet;
30aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkeyimport android.view.View;
31aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkeyimport android.view.ViewGroup;
328d8e2e838babfcaca2eaff99862652ce3aceac29Daniel Lehmannimport android.widget.ImageButton;
33aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkeyimport android.widget.LinearLayout;
34aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkeyimport android.widget.TextView;
35aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
36aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey/**
37aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey * Custom view for an entire section of data as segmented by
38aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey * {@link DataKind} around a {@link Data#MIMETYPE}. This view shows a
39aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey * section header and a trigger for adding new {@link Data} rows.
40aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey */
41bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmannpublic class KindSectionView extends LinearLayout implements EditorListener {
42aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    private static final String TAG = "KindSectionView";
43aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
44aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    private ViewGroup mEditors;
458d8e2e838babfcaca2eaff99862652ce3aceac29Daniel Lehmann    private ImageButton mAddPlusButton;
46aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    private TextView mTitle;
47aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
48aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    private DataKind mKind;
49aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    private EntityDelta mState;
5092525ff51e2cb06531447a7dcde5e22334669c8eMegha Joshi    private boolean mReadOnly;
516f8d46b5fb96c2bead1317aae93a73fc89b093abJeff Sharkey
524b722a93f1ecdeb2890fb7e5db4c22794bccfdcdMakoto Onuki    private ViewIdGenerator mViewIdGenerator;
534b722a93f1ecdeb2890fb7e5db4c22794bccfdcdMakoto Onuki
54aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    public KindSectionView(Context context) {
55aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey        super(context);
56aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    }
57aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
58aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    public KindSectionView(Context context, AttributeSet attrs) {
59aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey        super(context, attrs);
60aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    }
61aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
62aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    /** {@inheritDoc} */
63aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    @Override
64aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    protected void onFinishInflate() {
65aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey        setDrawingCacheEnabled(true);
66aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey        setAlwaysDrawnWithCacheEnabled(true);
67aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
68aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey        mEditors = (ViewGroup)findViewById(R.id.kind_editors);
69aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
708d8e2e838babfcaca2eaff99862652ce3aceac29Daniel Lehmann        mAddPlusButton = (ImageButton) findViewById(R.id.kind_plus);
718d8e2e838babfcaca2eaff99862652ce3aceac29Daniel Lehmann        mAddPlusButton.setOnClickListener(new OnClickListener() {
72bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann            public void onClick(View v) {
73bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann                addItem();
74bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann            }
75bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann        });
76aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
77aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey        mTitle = (TextView)findViewById(R.id.kind_title);
78aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    }
79aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
806f8d46b5fb96c2bead1317aae93a73fc89b093abJeff Sharkey    /** {@inheritDoc} */
81aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    public void onDeleted(Editor editor) {
82bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann        updateAddEnabled();
83bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann        updateVisible();
84aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    }
85aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
866f8d46b5fb96c2bead1317aae93a73fc89b093abJeff Sharkey    /** {@inheritDoc} */
876f8d46b5fb96c2bead1317aae93a73fc89b093abJeff Sharkey    public void onRequest(int request) {
886f8d46b5fb96c2bead1317aae93a73fc89b093abJeff Sharkey        // Ignore requests
896f8d46b5fb96c2bead1317aae93a73fc89b093abJeff Sharkey    }
906f8d46b5fb96c2bead1317aae93a73fc89b093abJeff Sharkey
914b722a93f1ecdeb2890fb7e5db4c22794bccfdcdMakoto Onuki    public void setState(DataKind kind, EntityDelta state, boolean readOnly, ViewIdGenerator vig) {
92aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey        mKind = kind;
93aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey        mState = state;
9492525ff51e2cb06531447a7dcde5e22334669c8eMegha Joshi        mReadOnly = readOnly;
954b722a93f1ecdeb2890fb7e5db4c22794bccfdcdMakoto Onuki        mViewIdGenerator = vig;
964b722a93f1ecdeb2890fb7e5db4c22794bccfdcdMakoto Onuki
974b722a93f1ecdeb2890fb7e5db4c22794bccfdcdMakoto Onuki        setId(mViewIdGenerator.getId(state, kind, null, ViewIdGenerator.NO_VIEW_INDEX));
98aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
99aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey        // TODO: handle resources from remote packages
100cfb525b3f18d71d6cc5d4ef36d704b3ba9e9a6f3Daniel Lehmann        final String title = (kind.titleRes == -1 || kind.titleRes == 0)
101cfb525b3f18d71d6cc5d4ef36d704b3ba9e9a6f3Daniel Lehmann                ? null
102cfb525b3f18d71d6cc5d4ef36d704b3ba9e9a6f3Daniel Lehmann                : getResources().getString(kind.titleRes);
103cfb525b3f18d71d6cc5d4ef36d704b3ba9e9a6f3Daniel Lehmann        mTitle.setText(title == null ? "" : title.toUpperCase());
104aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
105da5fd9039bd303f5e4634a31ed9a00d58d679b39Daniel Lehmann        // Only show the add button if this is a list
1068d8e2e838babfcaca2eaff99862652ce3aceac29Daniel Lehmann        mAddPlusButton.setVisibility(mKind.isList ? View.VISIBLE : View.INVISIBLE);
107da5fd9039bd303f5e4634a31ed9a00d58d679b39Daniel Lehmann
108bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann        rebuildFromState();
109bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann        updateAddEnabled();
110bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann        updateVisible();
111bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann    }
112bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann
113bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann    public CharSequence getTitle() {
114bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann        return mTitle.getText();
115aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    }
116aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
117aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    /**
118aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey     * Build editors for all current {@link #mState} rows.
119aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey     */
120aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    public void rebuildFromState() {
121aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey        // Remove any existing editors
122aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey        mEditors.removeAllViews();
123aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
124da5fd9039bd303f5e4634a31ed9a00d58d679b39Daniel Lehmann        // Check if we are displaying anything here
125da5fd9039bd303f5e4634a31ed9a00d58d679b39Daniel Lehmann        boolean hasEntries = mState.hasMimeEntries(mKind.mimeType);
126da5fd9039bd303f5e4634a31ed9a00d58d679b39Daniel Lehmann
127da5fd9039bd303f5e4634a31ed9a00d58d679b39Daniel Lehmann        if (hasEntries) {
128da5fd9039bd303f5e4634a31ed9a00d58d679b39Daniel Lehmann            for (ValuesDelta entry : mState.getMimeEntries(mKind.mimeType)) {
129da5fd9039bd303f5e4634a31ed9a00d58d679b39Daniel Lehmann                // Skip entries that aren't visible
130da5fd9039bd303f5e4634a31ed9a00d58d679b39Daniel Lehmann                if (!entry.isVisible()) continue;
1313e7436450f0fdd5ad939c3b46e7176e082c9ee11Daniel Lehmann                if (isEmptyNoop(entry)) continue;
132da5fd9039bd303f5e4634a31ed9a00d58d679b39Daniel Lehmann
133634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann                createEditorView(entry);
134da5fd9039bd303f5e4634a31ed9a00d58d679b39Daniel Lehmann            }
135aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey        }
136aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    }
137aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey
138634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann
139634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann    /**
140634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann     * Creates an EditorView for the given entry. This function must be used while constructing
141634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann     * the views corresponding to the the object-model. The resulting EditorView is also added
142634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann     * to the end of mEditors
143634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann     */
144634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann    private View createEditorView(ValuesDelta entry) {
145634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann        final View view;
146634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann        if (mKind.editorClass == null) {
147392ccec3b56e8074a5a028af28106134b39f64bcDaniel Lehmann            view = new TextFieldsEditorView(mContext);
148634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann        } else {
149634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann            try {
150634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann                view = mKind.editorClass.getConstructor(Context.class).newInstance(
151634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann                        mContext);
152634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann            } catch (Exception e) {
153634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann                throw new RuntimeException(
154634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann                        "Cannot allocate editor for " + mKind.editorClass);
155634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann            }
156634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann        }
157634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann
158634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann        if (view instanceof Editor) {
159634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann            Editor editor = (Editor) view;
160634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann            editor.setValues(mKind, entry, mState, mReadOnly, mViewIdGenerator);
161634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann            editor.setEditorListener(this);
162634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann            editor.setDeletable(true);
163634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann        }
164634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann        mEditors.addView(view);
165634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann        return view;
166634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann    }
167634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann
1689e83c84a7603eb6fca1b42631d894731d61f7a34Daniel Lehmann    /**
1693e7436450f0fdd5ad939c3b46e7176e082c9ee11Daniel Lehmann     * Tests whether the given item has no changes (so it exists in the database) but is empty
1703e7436450f0fdd5ad939c3b46e7176e082c9ee11Daniel Lehmann     */
1713e7436450f0fdd5ad939c3b46e7176e082c9ee11Daniel Lehmann    private boolean isEmptyNoop(ValuesDelta item) {
1723e7436450f0fdd5ad939c3b46e7176e082c9ee11Daniel Lehmann        if (!item.isNoop()) return false;
1733e7436450f0fdd5ad939c3b46e7176e082c9ee11Daniel Lehmann        final int fieldCount = mKind.fieldList.size();
1743e7436450f0fdd5ad939c3b46e7176e082c9ee11Daniel Lehmann        for (int i = 0; i < fieldCount; i++) {
1753e7436450f0fdd5ad939c3b46e7176e082c9ee11Daniel Lehmann            final String column = mKind.fieldList.get(i).column;
1763e7436450f0fdd5ad939c3b46e7176e082c9ee11Daniel Lehmann            final String value = item.getAsString(column);
1773e7436450f0fdd5ad939c3b46e7176e082c9ee11Daniel Lehmann            if (!TextUtils.isEmpty(value)) return false;
1783e7436450f0fdd5ad939c3b46e7176e082c9ee11Daniel Lehmann        }
1793e7436450f0fdd5ad939c3b46e7176e082c9ee11Daniel Lehmann        return true;
1803e7436450f0fdd5ad939c3b46e7176e082c9ee11Daniel Lehmann    }
1813e7436450f0fdd5ad939c3b46e7176e082c9ee11Daniel Lehmann
182bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann    private void updateVisible() {
183bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann        setVisibility(getEditorCount() != 0 ? VISIBLE : GONE);
184bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann    }
185bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann
186bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann
187aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    protected void updateAddEnabled() {
188aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey        // Set enabled state on the "add" view
189aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey        final boolean canInsert = EntityModifier.canInsert(mState, mKind);
190da5fd9039bd303f5e4634a31ed9a00d58d679b39Daniel Lehmann        final boolean isEnabled = !mReadOnly && canInsert;
1918d8e2e838babfcaca2eaff99862652ce3aceac29Daniel Lehmann        mAddPlusButton.setEnabled(isEnabled);
192aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    }
1936f8d46b5fb96c2bead1317aae93a73fc89b093abJeff Sharkey
194bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann    public void addItem() {
195bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann        // if this is a list, we can freely add. if not, only allow adding the first
196bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann        if (!mKind.isList && getEditorCount() == 1)
197da5fd9039bd303f5e4634a31ed9a00d58d679b39Daniel Lehmann            return;
198da5fd9039bd303f5e4634a31ed9a00d58d679b39Daniel Lehmann
199634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann        // Insert a new child, create its view and set its focus
2004b722a93f1ecdeb2890fb7e5db4c22794bccfdcdMakoto Onuki        final ValuesDelta newValues = EntityModifier.insertChild(mState, mKind);
201634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann        final View newField = createEditorView(newValues);
202634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann        newField.requestFocus();
2034b722a93f1ecdeb2890fb7e5db4c22794bccfdcdMakoto Onuki
204634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann        // For non-lists (e.g. Notes we can only have one field. in that case we need to disable
205634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann        // the add button
206634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann        updateAddEnabled();
207eeac4dc8dccb20466669525f16dc58fa593a3483Daniel Lehmann
208634ab3baaf2bc69bd7977153fcdebf0e737e207dDaniel Lehmann        // Ensure we are visible
209bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann        updateVisible();
210bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann    }
211bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann
212bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann    public int getEditorCount() {
213bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann        return mEditors.getChildCount();
214bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann    }
215bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann
216bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann    public DataKind getKind() {
217bb556954e29ae0700b729f128d8cd09ecdd91ee3Daniel Lehmann        return mKind;
218aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey    }
219aad8848282f51d73ad308e9ad3ebcef592fa153fJeff Sharkey}
220