diff options
Diffstat (limited to 'org.tizen.common/src/org/tizen/common/control/TableViewLabelProvider.java')
-rw-r--r-- | org.tizen.common/src/org/tizen/common/control/TableViewLabelProvider.java | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/org.tizen.common/src/org/tizen/common/control/TableViewLabelProvider.java b/org.tizen.common/src/org/tizen/common/control/TableViewLabelProvider.java deleted file mode 100644 index 12bfa05cb..000000000 --- a/org.tizen.common/src/org/tizen/common/control/TableViewLabelProvider.java +++ /dev/null @@ -1,121 +0,0 @@ -/*
-* Common
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact:
-* Kangho Kim <kh5325.kim@samsung.com>
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
-
-package org.tizen.common.control;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.graphics.Image;
-import org.tizen.common.model.ITableVO;
-
-
-
-
-
-public class TableViewLabelProvider extends ColumnLabelProvider implements ITableLabelProvider {
-
- public TableViewLabelProvider() {
- }
-
- private TableViewer viewer;
- CellEditor[] cellEditors;
-
- public TableViewLabelProvider(TableViewer viewer) {
- this.viewer = viewer;
- this.cellEditors = viewer.getCellEditors();
- }
-
- private Field[] fields;
-
- private int getColumnIndex(int columnIndex){
- return fields.length>columnIndex?columnIndex:fields.length;
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
-// private void hasCellEditor(){
-// if(this.cellEditors==null)
-// this.cellEditors = viewer.getCellEditors();
-// }
-
- private CellEditor getCellEditor(int idx) {
- if(this.cellEditors==null)
- return null;
- else
- return this.cellEditors[idx];
- }
-
- public String getColumnText(Object element, int columnIndex) {
- Object obj = null;
-
- if(element instanceof ITableVO){
- ITableVO data = (ITableVO)element;
- if(this.cellEditors != null){
- CellEditor ce = getCellEditor(columnIndex);
- if(ce instanceof ComboBoxCellEditor){
- ComboBoxCellEditor editor = (ComboBoxCellEditor)ce;
- String items[] = editor.getItems();
- int idx = (Integer) data.getColumnValue(columnIndex);
- if(idx<0)
- obj = null;
- else if(idx>items.length)
- obj = items[0];
- else
- obj = items[idx];
- }else{
- obj = data.getColumnValue(columnIndex);
- }
- }else{
- obj = data.getColumnValue(columnIndex);
- }
- }else{
- if(fields==null)
- fields = element.getClass().getDeclaredFields();
-
- int idx = getColumnIndex(columnIndex);
- String fieldName = fields[idx].getName().substring(0, 1).toUpperCase()
- + fields[idx].getName().substring(1,fields[idx].getName().length());
-
- try{
- Method method = element.getClass().getMethod("get" + fieldName, new Class[] {}); //$NON-NLS-1$
- obj = method.invoke(element, new Object[] {});
- }catch(Exception e){
- return ""; //$NON-NLS-1$
- }
- }
-
- return obj==null?"":String.valueOf(obj); //$NON-NLS-1$
- }
-
-
-}
|