1 package com.ca.directory.jxplorer.viewer; 2 3 import java.awt.*; 4 import javax.swing.*; 5 6 import com.ca.directory.jxplorer.DataSource; 7 import com.ca.directory.jxplorer.DataSink; 8 import com.ca.commons.naming.DXEntry; 9 import com.ca.commons.cbutil.CBIntText; 10 import com.ca.commons.cbutil.CBHelpSystem; 11 12 import javax.swing.ImageIcon ; 13 14 15 16 23 24 25 public class BasicPluggableEditor extends JPanel 26 implements DataSink, PluggableEditor 27 { 28 29 JEditorPane basicDisplay = null; 30 31 34 public BasicPluggableEditor() 35 { 36 setVisible(true); 37 } 38 39 protected void initDefaultEditor(String bloop) 40 { 41 basicDisplay = new JEditorPane("text/plain",bloop); 42 basicDisplay.setEditable(false); 43 basicDisplay.setFont(new Font("Monospaced",Font.PLAIN,12)); 44 this.removeAll(); 45 this.setLayout(new BorderLayout()); 46 this.add(basicDisplay, BorderLayout.CENTER); 47 this.repaint(); 48 this.invalidate(); 49 50 } 51 52 55 56 public void displayEntry(DXEntry entry, DataSource ds) 57 { 58 String bloop = entry.toString(); 59 initDefaultEditor(bloop); 60 } 61 62 68 69 public JComponent getDisplayComponent() 70 { 71 return this; 72 } 73 74 80 public Component getPrintComponent() 81 { 82 return getDisplayComponent(); 83 } 84 85 90 91 public DataSink getDataSink() 92 { 93 94 return this; 95 } 96 97 98 104 105 public boolean isUnique() 106 { 107 return false; 108 } 109 110 115 116 public String getName() 117 { 118 return CBIntText.get("Basic Editor"); 119 } 120 121 126 127 public ImageIcon getIcon() 128 { 129 return new ImageIcon (""); 130 } 131 132 137 138 public String getToolTip() 139 { 140 return ""; 141 } 142 143 151 152 public void registerComponents(JMenuBar menu, JToolBar buttons, JTree tree, JPopupMenu treeMenu, JFrame jxplorer) 153 { 154 } 156 157 158 162 163 public void unload() 164 { 165 } 167 168 171 172 public boolean canCreateEntry() 173 { 174 return false; 175 } 176 177 181 182 public ImageIcon getTreeIcon(String rdn) { return null; } 183 184 187 188 public JPopupMenu getPopupMenu(String rdn) { return null; } 189 190 193 194 public boolean hideSubEntries(String rdn) { return false; } 195 196 197 210 public void addLanguageBundle(String name) 211 { 212 CBIntText.addBundle(name, getClass().getClassLoader()); 213 } 214 215 227 228 public void addHelpSet(String name) 229 { 230 CBHelpSystem.addToDefaultHelpSystem(name, getClass().getClassLoader()); 231 } 232 233 } | Popular Tags |