1 19 package org.netbeans.modules.xml.schema.completion; 20 21 import java.awt.Component ; 22 import javax.swing.ImageIcon ; 23 import org.netbeans.modules.xml.axi.AbstractAttribute; 24 import org.netbeans.modules.xml.schema.completion.CompletionPaintComponent.AttributePaintComponent; 25 import org.netbeans.modules.xml.schema.completion.spi.CompletionContext; 26 27 31 public class AttributeResultItem extends CompletionResultItem { 32 33 36 public AttributeResultItem(AbstractAttribute attribute, CompletionContext context) { 37 super(attribute, context); 38 replacementText = attribute.getName(); 39 icon = new ImageIcon (CompletionResultItem.class. 40 getResource(ICON_LOCATION + ICON_ATTRIBUTE)); 41 } 42 43 46 public AttributeResultItem(AbstractAttribute attribute, String prefix, CompletionContext context) { 47 super(attribute, context); 48 replacementText = prefix + ":" + attribute.getName(); 49 icon = new ImageIcon (CompletionResultItem.class. 50 getResource(ICON_LOCATION + ICON_ATTRIBUTE)); 51 } 52 53 56 public String getReplacementText(){ 57 return replacementText+"=\"\""; 58 } 59 60 public String getItemText() { 61 displayText = replacementText; 62 return displayText; 63 } 64 65 public Component getPaintComponent(boolean isSelected) { 66 CompletionPaintComponent component = 67 new AttributePaintComponent(this); 68 component.setSelected(isSelected); 69 return component; 70 } 71 } 72 | Popular Tags |