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 java.awt.BorderLayout;
024 import java.awt.Dimension;
025 import java.awt.geom.Ellipse2D;
026 import java.awt.geom.RoundRectangle2D;
027
028 import javax.swing.DefaultListModel;
029 import javax.swing.JLabel;
030 import javax.swing.JList;
031 import javax.swing.JPanel;
032 import javax.swing.JScrollPane;
033 import javax.swing.event.ListSelectionListener;
034
035 import org.jdesktop.swingx.JXBusyLabel;
036 import org.jdesktop.swingx.icon.EmptyIcon;
037 import org.jdesktop.swingx.painter.BusyPainter;
038
039 /**
040 * Wizard panel where atomic classes are shown in list.
041 * @author Lorenz Buehmann
042 *
043 */
044 public class ClassPanelOWL extends JPanel{
045
046 private static final long serialVersionUID = 3026319637264844550L;
047
048 private javax.swing.JList conceptList;
049
050 private JPanel contentPanel;
051
052 private DefaultListModel model;
053 private JXBusyLabel loadingLabel;
054 private JLabel statusLabel;
055
056 /**
057 * Constructor.
058 */
059 @SuppressWarnings("unchecked")
060 public ClassPanelOWL() {
061
062 super();
063
064 model = new DefaultListModel();
065 loadingLabel = new JXBusyLabel(new Dimension(15, 15));
066 statusLabel = new JLabel();
067
068
069 BusyPainter painter = new BusyPainter(
070 new RoundRectangle2D.Float(0, 0, 6.0f, 2.6f, 10.0f, 10.0f),
071 new Ellipse2D.Float(2.0f, 2.0f, 11.0f, 11.0f));
072 painter.setTrailLength(2);
073 painter.setPoints(7);
074 painter.setFrame(-1);
075 loadingLabel.setPreferredSize(new Dimension(15, 15));
076 loadingLabel.setIcon(new EmptyIcon(15, 15));
077 loadingLabel.setBusyPainter(painter);
078
079
080
081 JPanel labelPanel = new JPanel();
082 labelPanel.add(loadingLabel);
083 labelPanel.add(statusLabel);
084
085
086 contentPanel = getContentPanel();
087 setLayout(new java.awt.BorderLayout());
088 add(contentPanel, BorderLayout.CENTER);
089 add(labelPanel, BorderLayout.SOUTH);
090 }
091
092 private JPanel getContentPanel() {
093
094 JPanel contentPanel1 = new JPanel();
095 JScrollPane scroll = new JScrollPane();
096
097
098 conceptList = new JList(model);
099 scroll.setPreferredSize(new Dimension(400, 400));
100 scroll.setViewportView(conceptList);
101 contentPanel1.add(scroll);
102
103
104
105 return contentPanel1;
106 }
107
108 /**
109 * Returns list model for owl-classes.
110 * @return the list model
111 */
112 public DefaultListModel getModel(){
113 return model;
114 }
115
116
117 /**
118 * Adds list selection listener to atomic classes list.
119 * @param l the default list selection listener
120 */
121 public void addSelectionListener(ListSelectionListener l){
122 conceptList.addListSelectionListener(l);
123 }
124
125 /**
126 * Returns the list where atomic owl classes are the list elements.
127 * @return instance of JList
128 */
129 public JList getList(){
130 return conceptList;
131 }
132
133 /**
134 * Returns the label which reports the loading status.
135 * @return instance of JLabel
136 */
137 public JLabel getStatusLabel() {
138 return statusLabel;
139 }
140
141 /**
142 * Returns the animated label for loading action.
143 * @return instance of JXBusyLabel
144 */
145 public JXBusyLabel getLoadingLabel() {
146 return loadingLabel;
147 }
148
149
150
151
152
153
154
155 }