001    /**
002     * Copyright (C) 2007-2008, Jens Lehmann
003     *
004     * This file is part of DL-Learner.
005     * 
006     * DL-Learner is free software; you can redistribute it and/or modify
007     * it under the terms of the GNU General Public License as published by
008     * the Free Software Foundation; either version 3 of the License, or
009     * (at your option) any later version.
010     *
011     * DL-Learner is distributed in the hope that it will be useful,
012     * but WITHOUT ANY WARRANTY; without even the implied warranty of
013     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014     * GNU General Public License for more details.
015     *
016     * You should have received a copy of the GNU General Public License
017     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
018     *
019     */
020    
021    package org.dllearner.tools.ore;
022    
023    import javax.swing.JMenuItem;
024    
025    import org.dllearner.core.owl.Description;
026    
027    /**
028     * Item for possible repair action.
029     * @author Lorenz Buehmann
030     *
031     */
032    public class DescriptionMenuItem extends JMenuItem {
033    
034            /**
035             * 
036             */
037            private static final long serialVersionUID = 6784086889435854440L;
038    
039            private Description desc;
040            private int action;
041            
042            public DescriptionMenuItem(int action, String text, Description d){
043                    super();
044                    if(action == 3){
045                            setText("remove class assertion to " + text);
046                    } else if(action == 0){
047                            setText(text);
048                    } else if(action == 2){
049                            setText("add class assertion to " + text);
050                    } else if(action == 4){
051                            setText(text);
052                    } else if(action == 6){
053                            setText("delete complete property " + text);
054                    }else if(action == 5){
055                            setText("remove all property assertions to " + text);
056                    } else if(action == 7){
057                            setText("remove all property assertions with range not in " + text);
058                    } else if(action == 1){
059                            setText(text);
060                    }
061                    
062                    this.desc = d;
063                    this.action = action;
064            }
065            
066            /**
067             * Returns the description part where item is asserted to.
068             * @return description
069             */
070            public Description getDescription(){
071                    return desc;
072            }
073            
074            /**
075             * Returns action type represented as number..
076             * @return number
077             */
078            public int getActionID(){
079                    return action;
080            }
081            
082            
083            
084    }