FileDocCategorySizeDatePackage
InfoPanel.javaAPI DocAndroid 1.5 API5475Wed May 06 22:41:08 BST 2009com.android.ddmuilib

InfoPanel

public class InfoPanel extends TablePanel
Display client info in a two-column format.

Fields Summary
private org.eclipse.swt.widgets.Table
mTable
private org.eclipse.swt.widgets.TableColumn
mCol2
private static final String[]
mLabels
private static final int
ENT_DDM_AWARE
private static final int
ENT_APP_DESCR
private static final int
ENT_VM_VERSION
private static final int
ENT_PROCESS_ID
Constructors Summary
Methods Summary
public voidclientChanged(com.android.ddmlib.Client client, int changeMask)
Sent when an existing client information changed.

This is sent from a non UI thread.

param
client the updated client.
param
changeMask the bit mask describing the changed properties. It can contain any of the following values: {@link Client#CHANGE_PORT}, {@link Client#CHANGE_NAME} {@link Client#CHANGE_DEBUGGER_INTEREST}, {@link Client#CHANGE_THREAD_MODE}, {@link Client#CHANGE_THREAD_DATA}, {@link Client#CHANGE_HEAP_MODE}, {@link Client#CHANGE_HEAP_DATA}, {@link Client#CHANGE_NATIVE_HEAP_DATA}
see
IClientChangeListener#clientChanged(Client, int)

        if (client == getCurrentClient()) {
            if ((changeMask & Client.CHANGE_INFO) == Client.CHANGE_INFO) {
                if (mTable.isDisposed())
                    return;

                mTable.getDisplay().asyncExec(new Runnable() {
                    public void run() {
                        clientSelected();
                    }
                });
            }
        }
    
public voidclientSelected()
Sent when a new client is selected. The new client can be accessed with {@link #getCurrentClient()}

        if (mTable.isDisposed())
            return;

        Client client = getCurrentClient();

        if (client == null) {
            for (int i = 0; i < mLabels.length; i++) {
                TableItem item = mTable.getItem(i);
                item.setText(1, "-");
            }
        } else {
            TableItem item;
            String clientDescription, vmIdentifier, isDdmAware,
                pid;

            ClientData cd = client.getClientData();
            synchronized (cd) {
                clientDescription = (cd.getClientDescription() != null) ?
                        cd.getClientDescription() : "?";
                vmIdentifier = (cd.getVmIdentifier() != null) ?
                        cd.getVmIdentifier() : "?";
                isDdmAware = cd.isDdmAware() ?
                        "yes" : "no";
                pid = (cd.getPid() != 0) ?
                        String.valueOf(cd.getPid()) : "?";
            }

            item = mTable.getItem(ENT_APP_DESCR);
            item.setText(1, clientDescription);
            item = mTable.getItem(ENT_VM_VERSION);
            item.setText(1, vmIdentifier);
            item = mTable.getItem(ENT_DDM_AWARE);
            item.setText(1, isDdmAware);
            item = mTable.getItem(ENT_PROCESS_ID);
            item.setText(1, pid);
        }

        mCol2.pack();

        //Log.i("ddms", "InfoPanel: changed " + client);
    
protected org.eclipse.swt.widgets.ControlcreateControl(org.eclipse.swt.widgets.Composite parent)
Create our control(s).


            
    
        
        mTable = new Table(parent, SWT.MULTI | SWT.FULL_SELECTION);
        mTable.setHeaderVisible(false);
        mTable.setLinesVisible(false);

        TableColumn col1 = new TableColumn(mTable, SWT.RIGHT);
        col1.setText("name");
        mCol2 = new TableColumn(mTable, SWT.LEFT);
        mCol2.setText("PlaceHolderContentForWidth");

        TableItem item;
        for (int i = 0; i < mLabels.length; i++) {
            item = new TableItem(mTable, SWT.NONE);
            item.setText(0, mLabels[i]);
            item.setText(1, "-");
        }

        col1.pack();
        mCol2.pack();

        return mTable;
    
public voiddeviceSelected()
Sent when a new device is selected. The new device can be accessed with {@link #getCurrentDevice()}

        // pass
    
public voidsetFocus()
Sets the focus to the proper control inside the panel.

        mTable.setFocus();
    
protected voidsetTableFocusListener()

        addTableToFocusListener(mTable);