Package de.FeatureModellingTool.InfoExplorer2

Source Code of de.FeatureModellingTool.InfoExplorer2.FeatureTreeTableModel

/**
* @file: FeatureTreeTableModel.java
* @author: tlc
* @date: 2006-12-9
* @version: 1.0.0
*/
package de.FeatureModellingTool.InfoExplorer2;

import de.FeatureModellingTool.FeatureModel.Feature;
import org.jdesktop.swingx.treetable.DefaultTreeTableModel;

/**
* @author tlc
*/
public class FeatureTreeTableModel extends DefaultTreeTableModel {

    public FeatureTreeTableModel(FeatureNode root) {
        super(root);
    }

    @Override
    public int getColumnCount() {
        return 4;
    }

    @Override
    public String getColumnName(int column) {
        switch (column) {
            case 0:
                return "Name";
            case 1:
                return "Catetory";
            case 2:
                return "Optionality";
            case 3:
                return "Binding time";
            case 4:
                return "Description";
            default:
                return "Column " + column;
        }
    }

    @Override
    public Object getValueAt(Object node, int column) {

        String nodeType = ((FeatureNode) node).getNodeType();
        if (nodeType.equals(FeatureNode.NODE_TYPE_NORMAL)) {
            Feature feature = ((FeatureNode) node).getFeature();
            switch (column) {
                case 0:
                    return feature.getName();
                case 1:
                    return feature.getCategory();
                case 2:
                    return feature.getVariability();
                case 3:
                    return feature.getBindingTime();
                case 4:
                    return feature.getDescription();
                default:
                    return "";
            }
        } else {
            switch (column) {
                case 0:
                    return ((FeatureNode) node).toString();
                default:
                    return "";
            }
        }
    }

    @Override
    public int getHierarchicalColumn() {
        return 0;
    }
}
TOP

Related Classes of de.FeatureModellingTool.InfoExplorer2.FeatureTreeTableModel

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.