Debian Codegraph @

rule-api/src/main/java/com/android/ide/common/api/AbstractViewRule.java

raw
1 /*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
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 package com.android.ide.common.api;
17
18 import com.android.annotations.NonNull;
19 import com.android.annotations.Nullable;
20 import com.google.common.annotations.Beta;
21
22 import java.util.List;
23
24 /**
25 * Default implementation of an {@link IViewRule}. This is a convenience
26 * implementation which makes it easier to supply designtime behavior for a
27 * custom view and just override the methods you are interested in.
28 * <p>
29 * <b>NOTE: This is not a public or final API; if you rely on this be prepared
30 * to adjust your code for the next tools release.</b>
31 */
32 @Beta
33 public class AbstractViewRule implements IViewRule {
34 @Override
35 public boolean onInitialize(@NonNull String fqcn, @NonNull IClientRulesEngine engine) {
36 return true;
37 }
38
39 @Override
40 public void onDispose() {
41 }
42
43 @Override
44 @Nullable
45 public String getDisplayName() {
46 // Default is to not override the selection display name.
47 return null;
48 }
49
50 @Override
51 @Nullable
52 public List<String> getSelectionHint(@NonNull INode parentNode, @NonNull INode childNode) {
53 return null;
54 }
55
56 @Override
57 public void addLayoutActions(@NonNull List<RuleAction> actions, @NonNull INode parentNode,
58 @NonNull List<? extends INode> children) {
59 }
60
61 @Override
62 public void addContextMenuActions(@NonNull List<RuleAction> actions, @NonNull INode node) {
63 }
64
65 @Override
66 @Nullable
67 public String getDefaultActionId(@NonNull INode node) {
68 return null;
69 }
70
71 @Override
72 public void paintSelectionFeedback(@NonNull IGraphics graphics, @NonNull INode parentNode,
73 @NonNull List<? extends INode> childNodes, @Nullable Object view) {
74 }
75
76 @Override
77 @Nullable
78 public DropFeedback onDropEnter(@NonNull INode targetNode, @Nullable Object targetView,
79 @Nullable IDragElement[] elements) {
80 return null;
81 }
82
83 @Override
84 @Nullable
85 public DropFeedback onDropMove(@NonNull INode targetNode, @NonNull IDragElement[] elements,
86 @Nullable DropFeedback feedback, @NonNull Point p) {
87 return null;
88 }
89
90 @Override
91 public void onDropLeave(@NonNull INode targetNode, @NonNull IDragElement[] elements,
92 @Nullable DropFeedback feedback) {
93 // ignore
94 }
95
96 @Override
97 public void onDropped(
98 @NonNull INode targetNode,
99 @NonNull IDragElement[] elements,
100 @Nullable DropFeedback feedback,
101 @NonNull Point p) {
102 // ignore
103 }
104
105
106 @Override
107 public void onPaste(@NonNull INode targetNode, @Nullable Object targetView,
108 @NonNull IDragElement[] pastedElements) {
109 }
110
111 @Override
112 public void onCreate(@NonNull INode node, @NonNull INode parent,
113 @NonNull InsertType insertType) {
114 }
115
116 @Override
117 public void onChildInserted(@NonNull INode child, @NonNull INode parent,
118 @NonNull InsertType insertType) {
119 }
120
121 @Override
122 public void onRemovingChildren(@NonNull List<INode> deleted, @NonNull INode parent,
123 boolean moved) {
124 }
125
126 @Override
127 @Nullable
128 public DropFeedback onResizeBegin(@NonNull INode child, @NonNull INode parent,
129 @Nullable SegmentType horizontalEdge,
130 @Nullable SegmentType verticalEdge, @Nullable Object childView,
131 @Nullable Object parentView) {
132 return null;
133 }
134
135 @Override
136 public void onResizeUpdate(@Nullable DropFeedback feedback, @NonNull INode child,
137 @NonNull INode parent, @NonNull Rect newBounds,
138 int modifierMask) {
139 }
140
141 @Override
142 public void onResizeEnd(@Nullable DropFeedback feedback, @NonNull INode child,
143 @NonNull INode parent, @NonNull Rect newBounds) {
144 }
145 }