1 /* 2 * Copyright (C) 2007 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 17 package com.android.ddmuilib; 18 19 import org.eclipse.swt.widgets.Composite; 20 import org.eclipse.swt.widgets.Control; 21 22 23 /** 24 * Base class for our information panels. 25 */ 26 public abstract class Panel { 27 createPanel(Composite parent)28 public final Control createPanel(Composite parent) { 29 Control panelControl = createControl(parent); 30 31 postCreation(); 32 33 return panelControl; 34 } 35 postCreation()36 protected abstract void postCreation(); 37 38 /** 39 * Creates a control capable of displaying some information. This is 40 * called once, when the application is initializing, from the UI thread. 41 */ createControl(Composite parent)42 protected abstract Control createControl(Composite parent); 43 44 /** 45 * Sets the focus to the proper control inside the panel. 46 */ setFocus()47 public abstract void setFocus(); 48 } 49 50