1 19 27 28 package org.netbeans.modules.xml.schema.abe; 29 30 import java.awt.Color ; 31 import java.awt.Font ; 32 import java.beans.PropertyChangeEvent ; 33 import java.beans.PropertyChangeListener ; 34 import javax.swing.JLabel ; 35 import org.netbeans.modules.xml.axi.Compositor; 36 import org.openide.util.NbBundle; 37 38 42 public class CompositorPropertiesPanel extends ExtraPropertiesPanel{ 43 private static final long serialVersionUID = 7526472295622776147L; 44 private Compositor compositor; 45 46 48 49 public CompositorPropertiesPanel(Compositor compositor, InstanceUIContext context) { 50 super(true, context); 51 this.compositor = compositor; 52 refreshItems(); 54 55 compositor.addPropertyChangeListener(new ModelEventMediator(this, compositor){ 56 public void _propertyChange(PropertyChangeEvent evt) { 57 refreshItems(); 60 } 61 }); 62 63 if(compositor.getContentModel() != null){ 64 compositor.getContentModel().addPropertyChangeListener(new ModelEventMediator(this, compositor.getContentModel()) { 65 public void _propertyChange(PropertyChangeEvent evt) { 66 refreshItems(); 67 } 68 }); 69 } 70 } 71 72 private void refreshItems() { 73 cleanupAll(); 74 if(compositor.supportsCardinality()){ 76 String str = UIUtilities.getConstraintsString(compositor.getMinOccurs(), compositor.getMaxOccurs()); 77 if(str != null){ 78 JLabel constraints = new JLabel (str); Font font = constraints.getFont(); 80 font = new Font (font.getFontName(), Font.PLAIN, 81 InstanceDesignConstants.PROPS_FONT_SIZE); 82 constraints.setFont(font); 83 constraints.setForeground(new Color (139, 139, 139)); 84 constraints.setToolTipText(NbBundle.getMessage(ElementPropertiesPanel.class, 85 "TTP_COMPOSITOR_CARDINALITY")); 86 append(constraints, true); 87 } 88 } 89 if(compositor.getContentModel() != null){ 91 JLabel contentModelInfoLabel = UIUtilities.getContentModelInfoLabel(compositor, false, true, context); 93 if(contentModelInfoLabel != null) 94 append(contentModelInfoLabel, false); 95 } 96 revalidate(); 97 repaint(); 98 99 } 100 101 102 103 } 104 | Popular Tags |