blob: a279de68635eff84235e878979efb79ee3de1575 [file] [log] [blame]
Dianne Hackborn3aa49b62013-04-26 16:39:17 -07001/*
2 * Copyright (C) 2013 The Android Open Source Project
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
17package android.content;
18
19/**
20 * Representation of an owner of {@link UndoOperation} objects in an {@link UndoManager}.
21 */
22public class UndoOwner {
23 final String mTag;
24
25 UndoManager mManager;
26 Object mData;
27 int mOpCount;
28
29 // For saving/restoring state.
30 int mStateSeq;
31 int mSavedIdx;
32
33 UndoOwner(String tag) {
34 mTag = tag;
35 }
36
37 /**
38 * Return the unique tag name identifying this owner. This is the tag
39 * supplied to {@link UndoManager#getOwner(String, Object) UndoManager.getOwner}
40 * and is immutable.
41 */
42 public String getTag() {
43 return mTag;
44 }
45
46 /**
47 * Return the actual data object of the owner. This is the data object
48 * supplied to {@link UndoManager#getOwner(String, Object) UndoManager.getOwner}. An
49 * owner may have a null data if it was restored from a previously saved state with
50 * no getOwner call to associate it with its data.
51 */
52 public Object getData() {
53 return mData;
54 }
55}