1 19 20 package org.lucane.applications.administrator.gui; 21 22 import java.awt.*; 23 import javax.swing.*; 24 import javax.swing.event.*; 25 26 27 import org.lucane.common.concepts.*; 28 import org.lucane.applications.administrator.AdministratorPlugin; 29 30 public class ConceptPanel extends JPanel 31 implements ListSelectionListener 32 { 33 private ConceptListPanel conceptList; 34 private UserPanel userPanel; 35 private ServicePanel servicePanel; 36 private PluginPanel pluginPanel; 37 private GroupPanel groupPanel; 38 39 private JSplitPane splitPane; 40 41 public ConceptPanel(AdministratorPlugin plugin) 42 { 43 super(new BorderLayout()); 44 conceptList = new ConceptListPanel(plugin, this); 46 conceptList.addListSelectionListener(this); 47 userPanel = new UserPanel(plugin, this); 48 servicePanel = new ServicePanel(plugin, this); 49 pluginPanel = new PluginPanel(plugin, this); 50 groupPanel = new GroupPanel(plugin, this); 51 52 splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, conceptList, new JPanel()); 54 splitPane.setDividerLocation(250); 55 splitPane.setDividerSize(5); 56 this.add(splitPane, BorderLayout.CENTER); 57 } 58 59 public void valueChanged(ListSelectionEvent e) 60 { 61 int row = conceptList.getSelectedRow(); 62 if(row < 0) 63 return; 64 65 Concept concept = conceptList.getConceptAt(row); 66 showConcept(concept); 67 } 68 69 public void refresh() 70 { 71 conceptList.refresh(); 72 } 73 74 public void showConcept(Concept concept) 75 { 76 if(concept == null) 77 splitPane.setBottomComponent(new JPanel()); 78 else if(concept instanceof GroupConcept) 79 { 80 groupPanel.showConcept((GroupConcept)concept); 81 splitPane.setBottomComponent(groupPanel); 82 } 83 else if(concept instanceof UserConcept) 84 { 85 userPanel.showConcept((UserConcept)concept); 86 splitPane.setBottomComponent(userPanel); 87 } 88 else if(concept instanceof PluginConcept) 89 { 90 pluginPanel.showConcept((PluginConcept)concept); 91 splitPane.setBottomComponent(pluginPanel); 92 } 93 else if(concept instanceof ServiceConcept) 94 { 95 servicePanel.showConcept((ServiceConcept)concept); 96 splitPane.setBottomComponent(servicePanel); 97 } 98 99 splitPane.setDividerLocation(250); 100 } 101 } | Popular Tags |