2 * Copyright (C) 2009 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.hierarchyviewer.ui.model;
19 import javax.swing.table.DefaultTableModel;
20 import java.text.NumberFormat;
22 public class ProfilesTableModel extends DefaultTableModel {
23 private static final String[] NAMES = { "measure", "layout", "draw" };
25 private final double[] profiles;
26 private final NumberFormat formatter;
28 public ProfilesTableModel(double[] profiles) {
29 this.profiles = profiles;
30 formatter = NumberFormat.getNumberInstance();
34 public int getRowCount() {
35 return profiles == null ? 0 : profiles.length;
39 public Object getValueAt(int row, int column) {
40 if (profiles == null) return "";
47 return formatter.format(profiles[row]) + "";
51 public int getColumnCount() {
56 public String getColumnName(int column) {
57 return column == 0 ? "Operation" : "Duration (ms)";
61 public boolean isCellEditable(int arg0, int arg1) {
66 public void setValueAt(Object arg0, int arg1, int arg2) {