1 /**
2  * Created on Jan 5, 2009
3  *
4  * Copyright (C) Azureus Software, Inc, All Rights Reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
19  */
20 
21 package com.aelitis.azureus.ui.common.table.impl;
22 
23 import com.aelitis.azureus.ui.common.table.TableColumnCore;
24 
25 import org.gudy.azureus2.plugins.ui.tables.TableColumnInfo;
26 
27 /**
28  * @author TuxPaper
29  * @created Jan 5, 2009
30  *
31  */
32 public class TableColumnInfoImpl
33 	implements TableColumnInfo
34 {
35 	String[] categories;
36 
37 	byte proficiency = TableColumnInfo.PROFICIENCY_INTERMEDIATE;
38 
39 	private final TableColumnCore column;
40 
41 	/**
42 	 * @param column
43 	 */
TableColumnInfoImpl(TableColumnCore column)44 	public TableColumnInfoImpl(TableColumnCore column) {
45 		this.column = column;
46 	}
47 
getColumn()48 	public TableColumnCore getColumn() {
49 		return column;
50 	}
51 
52 	// @see org.gudy.azureus2.ui.swt.views.table.utils.TableColumnInfo#getCategories()
getCategories()53 	public String[] getCategories() {
54 		return categories;
55 	}
56 
57 	// @see org.gudy.azureus2.ui.swt.views.table.utils.TableColumnInfo#setCategories(java.lang.String[])
addCategories(String[] categories)58 	public void addCategories(String[] categories) {
59 		if (categories == null || categories.length == 0) {
60 			return;
61 		}
62 		int pos;
63 		String[] newCategories;
64 		if (this.categories == null) {
65 			newCategories = new String[categories.length];
66 			pos = 0;
67 		} else {
68 			newCategories = new String[categories.length + this.categories.length];
69 			pos = this.categories.length;
70 			System.arraycopy(this.categories, 0, newCategories, 0, pos);
71 		}
72 		System.arraycopy(categories, pos, newCategories, 0, categories.length);
73 		this.categories = newCategories;
74 	}
75 
76 	// @see org.gudy.azureus2.ui.swt.views.table.utils.TableColumnInfo#getProficiency()
getProficiency()77 	public byte getProficiency() {
78 		return proficiency;
79 	}
80 
81 	// @see org.gudy.azureus2.ui.swt.views.table.utils.TableColumnInfo#setProficiency(int)
setProficiency(byte proficiency)82 	public void setProficiency(byte proficiency) {
83 		this.proficiency = proficiency;
84 	}
85 }
86