2 * Copyright (C) 2007 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.android.ddmuilib;
19 import com.android.ddmlib.Client;
20 import com.android.ddmlib.IDevice;
23 * A Panel that requires {@link Device}/{@link Client} selection notifications.
25 public abstract class SelectionDependentPanel extends Panel {
26 private IDevice mCurrentDevice = null;
27 private Client mCurrentClient = null;
30 * Returns the current {@link Device}.
31 * @return the current device or null if none are selected.
33 protected final IDevice getCurrentDevice() {
34 return mCurrentDevice;
38 * Returns the current {@link Client}.
39 * @return the current client or null if none are selected.
41 protected final Client getCurrentClient() {
42 return mCurrentClient;
46 * Sent when a new device is selected.
47 * @param selectedDevice the selected device.
49 public final void deviceSelected(IDevice selectedDevice) {
50 if (selectedDevice != mCurrentDevice) {
51 mCurrentDevice = selectedDevice;
57 * Sent when a new client is selected.
58 * @param selectedClient the selected client.
60 public final void clientSelected(Client selectedClient) {
61 if (selectedClient != mCurrentClient) {
62 mCurrentClient = selectedClient;
68 * Sent when a new device is selected. The new device can be accessed
69 * with {@link #getCurrentDevice()}.
71 public abstract void deviceSelected();
74 * Sent when a new client is selected. The new client can be accessed
75 * with {@link #getCurrentClient()}.
77 public abstract void clientSelected();