View Javadoc
1 /*** 2 * $Header: /cvsroot/ebxmlrr/jaxr/src/com/sun/xml/registry/client/browser/ExternalIdentifiersList.java,v 1.6 2003/08/08 04:49:38 farrukh_najmi Exp $ 3 */ 4 package com.sun.xml.registry.client.browser; 5 6 import java.util.*; 7 import javax.xml.registry.*; 8 import javax.xml.registry.infomodel.*; 9 10 import java.awt.*; 11 import java.awt.event.*; 12 import javax.swing.*; 13 import javax.swing.event.*; 14 15 /*** 16 * Specialized JList for showing ExternalIdentifiers. 17 * Supports drag&drop of ExternalIdentifier objects. 18 * 19 * @author <a href="mailto:Farrukh.Najmi@Sun.COM">Farrukh S. Najmi</a> 20 */ 21 public class ExternalIdentifiersList extends RegistryObjectsList { 22 23 24 /*** 25 * Default constructor 26 */ 27 public ExternalIdentifiersList() { 28 this(new ExternalIdentifiersListModel()); 29 } 30 31 /*** 32 * Constructor 33 */ 34 public ExternalIdentifiersList(ExternalIdentifiersListModel model) { 35 super(LifeCycleManager.EXTERNAL_IDENTIFIER, model); 36 37 setCellRenderer(new ExternalIdentifierRenderer()); 38 } 39 40 class ExternalIdentifierRenderer extends JLabel implements ListCellRenderer { 41 public ExternalIdentifierRenderer() { 42 setOpaque(true); 43 //setHorizontalAlignment(CENTER); 44 //setVerticalAlignment(CENTER); 45 } 46 47 public Component getListCellRendererComponent( 48 JList list, 49 Object value, 50 int index, 51 boolean isSelected, 52 boolean cellHasFocus) { 53 54 if (isSelected) { 55 setBackground(list.getSelectionBackground()); 56 setForeground(list.getSelectionForeground()); 57 } 58 else { 59 setBackground(list.getBackground()); 60 setForeground(list.getForeground()); 61 } 62 63 try { 64 ExternalIdentifiersListModel model = (ExternalIdentifiersListModel)list.getModel(); 65 ExternalIdentifier extId = (ExternalIdentifier)(model.elementAt(index)); 66 ClassificationScheme scheme = extId.getIdentificationScheme(); 67 String schemeName = RegistryBrowser.getName(scheme); 68 69 String keyName = RegistryBrowser.getName(extId); 70 String keyValue = extId.getValue(); 71 String str = schemeName + ":" + keyName + ":" + keyValue; 72 73 setText(str); 74 } 75 catch (JAXRException e) { 76 RegistryBrowser.displayError(e); 77 } 78 79 return this; 80 } 81 } 82 83 }

This page was automatically generated by Maven