1 19 24 package org.openide.explorer.propertysheet; 25 26 import java.awt.Color ; 27 import java.awt.Component ; 28 import java.awt.Dimension ; 29 import java.awt.Font ; 30 import java.awt.Graphics ; 31 import java.awt.Image ; 32 import java.awt.Rectangle ; 33 import java.awt.Toolkit ; 34 import java.awt.event.ActionEvent ; 35 import java.awt.event.ActionListener ; 36 import java.awt.event.ComponentListener ; 37 import java.awt.event.ContainerListener ; 38 import java.awt.event.FocusEvent ; 39 import java.awt.event.HierarchyBoundsListener ; 40 import java.awt.event.HierarchyListener ; 41 import java.awt.event.MouseEvent ; 42 import java.beans.PropertyChangeEvent ; 43 import java.beans.PropertyChangeListener ; 44 import java.beans.PropertyEditor ; 45 import java.lang.reflect.InvocationTargetException ; 46 import java.util.logging.Level ; 47 import java.util.logging.Logger ; 48 import javax.swing.BorderFactory ; 49 import javax.swing.Icon ; 50 import javax.swing.ImageIcon ; 51 import javax.swing.JCheckBox ; 52 import javax.swing.JComboBox ; 53 import javax.swing.JComponent ; 54 import javax.swing.JLabel ; 55 import javax.swing.KeyStroke ; 56 import javax.swing.border.BevelBorder ; 57 import javax.swing.border.Border ; 58 import javax.swing.event.ChangeListener ; 59 import org.openide.awt.HtmlRenderer; 60 import org.openide.nodes.Node.Property; 61 import org.openide.util.Utilities; 62 63 80 final class RendererFactory { 81 82 private StringRenderer stringRenderer; 83 private CheckboxRenderer checkboxRenderer; 84 private ComboboxRenderer comboboxRenderer; 85 private RadioRenderer radioRenderer; 86 private TextFieldRenderer textFieldRenderer; 87 private ButtonPanel buttonPanel; 88 private IconPanel iconPanel; 89 private ReusablePropertyModel mdl; 90 private ReusablePropertyEnv env; 91 private boolean tableUI; 92 private boolean suppressButton; 93 private int radioButtonMax = -1; 94 private boolean useRadioBoolean = PropUtils.forceRadioButtons; 95 private boolean useLabels; 96 97 98 public RendererFactory(boolean tableUI, ReusablePropertyEnv env, ReusablePropertyModel mdl) { 99 this.tableUI = tableUI; 100 this.env = env; 101 this.mdl = mdl; 102 103 104 Toolkit.getDefaultToolkit().addPropertyChangeListener( "win.xpstyle.themeActive", new PropertyChangeListener () { public void propertyChange(PropertyChangeEvent evt) { 107 stringRenderer = null; 108 checkboxRenderer = null; 109 comboboxRenderer = null; 110 radioRenderer = null; 111 textFieldRenderer = null; 112 buttonPanel = null; 113 iconPanel = null; 114 } 115 }); 116 } 117 118 public void setRadioButtonMax(int i) { 119 radioButtonMax = i; 120 } 121 122 public void setSuppressButton(boolean val) { 123 suppressButton = val; 124 } 125 126 void setUseRadioBoolean(boolean val) { 127 useRadioBoolean = val; 128 } 129 130 132 void setUseLabels(boolean val) { 133 useLabels = val; 134 } 135 136 137 public JComponent getRenderer(Property prop) { 138 mdl.setProperty(prop); 139 env.reset(); 140 141 PropertyEditor editor = preparePropertyEditor(mdl, env); 142 143 if (editor instanceof ExceptionPropertyEditor) { 144 return getExceptionRenderer((Exception ) editor.getValue()); 145 } 146 147 JComponent result = null; 148 149 try { 150 if (editor.isPaintable()) { 151 result = prepareString(editor, env); 152 } else { 153 Class c = mdl.getPropertyType(); 154 155 if ((c == Boolean .class) || (c == boolean.class)) { 156 boolean useRadioRenderer = useRadioBoolean || 158 (env.getFeatureDescriptor().getValue("stringValues") != null); 160 if (useRadioRenderer) { 161 result = prepareRadioButtons(editor, env); 162 } else { 163 result = prepareCheckbox(editor, env); 164 } 165 } else if (editor.getTags() != null) { 166 String [] s = editor.getTags(); 167 boolean editAsText = Boolean.TRUE.equals(prop.getValue("canEditAsText")); 168 169 if ((s.length <= radioButtonMax) && !editAsText) { 170 result = prepareRadioButtons(editor, env); 171 } else { 172 result = prepareCombobox(editor, env); 173 } 174 } else { 175 result = prepareString(editor, env); 176 } 177 } 178 179 if ((result != radioRenderer) && (result != textFieldRenderer)) { 180 if ((result != checkboxRenderer) && tableUI && !(result instanceof JComboBox )) { 181 result.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0)); 182 } else if ((result instanceof JComboBox ) && tableUI) { 183 result.setBorder(BorderFactory.createEmptyBorder()); 184 } else if (!(result instanceof JComboBox ) && (!(result instanceof JCheckBox ))) { 185 result.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); 186 } 187 } 188 } catch (Exception e) { 189 result = getExceptionRenderer(e); 190 Logger.getLogger(RendererFactory.class.getName()).log(Level.WARNING, null, e); 191 } 192 193 result.setEnabled(prop.canWrite()); 194 195 boolean propRequestsSuppressButton = Boolean.TRUE.equals(prop.getValue("suppressCustomEditor")); 197 if ( 198 !(result instanceof JLabel ) && 199 ((env.getState() == env.STATE_INVALID) || (prop.getValue("valueIcon") != null)) 200 ) { result = prepareIconPanel(editor, env, (InplaceEditor) result); 202 } 203 204 206 if ( 207 editor.supportsCustomEditor() && !PropUtils.noCustomButtons && !suppressButton && 208 !propRequestsSuppressButton 209 ) { 210 ButtonPanel bp = buttonPanel(); 211 bp.setInplaceEditor((InplaceEditor) result); 212 result = bp; 213 } 214 215 return result; 216 } 217 218 private IconPanel prepareIconPanel(PropertyEditor ed, PropertyEnv env, InplaceEditor inner) { 219 IconPanel icp = iconPanel(); 220 icp.setInplaceEditor(inner); 221 icp.connect(ed, env); 222 223 return icp; 224 } 225 226 private PropertyEditor preparePropertyEditor(PropertyModel pm, PropertyEnv env) { 227 PropertyEditor result; 228 229 try { 230 if (pm instanceof NodePropertyModel) { 231 result = ((NodePropertyModel) pm).getPropertyEditor(); 232 } else if (pm instanceof ReusablePropertyModel) { 233 result = ((ReusablePropertyModel) pm).getPropertyEditor(); 234 } else { 235 Class c = pm.getPropertyEditorClass(); 236 237 if (c != null) { 238 try { 239 result = (PropertyEditor ) c.newInstance(); 240 241 Object mdlValue = pm.getValue(); 243 Object edValue = result.getValue(); 244 245 if (edValue != mdlValue) { 246 result.setValue(pm.getValue()); 247 } 248 } catch (Exception e) { 249 result = new ExceptionPropertyEditor(e); 250 } 251 } else { 252 result = PropUtils.getPropertyEditor(pm.getPropertyType()); 253 254 try { 255 result.setValue(pm.getValue()); 256 } catch (InvocationTargetException ite) { 257 result = new ExceptionPropertyEditor(ite); 258 } 259 } 260 } 261 } catch (Exception e) { 262 result = new ExceptionPropertyEditor(e); 263 } 264 265 if (result instanceof ExPropertyEditor) { 266 ((ExPropertyEditor) result).attachEnv(env); 267 } 268 269 return result; 270 } 271 272 private JComponent getExceptionRenderer(Exception e) { 273 ExceptionRenderer lbl = new ExceptionRenderer(); 275 lbl.setForeground(PropUtils.getErrorColor()); 276 lbl.setText(e.getMessage()); 277 278 return lbl; 279 } 280 281 public JComponent getStringRenderer() { 282 StringRenderer result = stringRenderer(); 283 result.clear(); 284 result.setEnabled(true); 285 286 return result; 287 } 288 289 private JComponent prepareRadioButtons(PropertyEditor editor, PropertyEnv env) { 290 RadioRenderer ren = radioRenderer(); 291 ren.clear(); 292 ren.setUseTitle(useLabels); 293 ren.connect(editor, env); 294 295 return ren.getComponent(); 296 } 297 298 private JComponent prepareCombobox(PropertyEditor editor, PropertyEnv env) { 299 ComboboxRenderer ren = comboboxRenderer(); 300 ren.clear(); 301 ren.setEnabled(true); 302 ren.connect(editor, env); 303 304 return ren.getComponent(); 305 } 306 307 private JComponent prepareString(PropertyEditor editor, PropertyEnv env) { 308 InplaceEditor ren = (tableUI || editor.isPaintable()) ? (InplaceEditor) stringRenderer() 309 : (InplaceEditor) textFieldRenderer(); 310 ren.clear(); 311 ren.getComponent().setEnabled(true); 312 ren.connect(editor, env); 313 314 return ren.getComponent(); 315 } 316 317 private JComponent prepareCheckbox(PropertyEditor editor, PropertyEnv env) { 318 CheckboxRenderer ren = checkboxRenderer(); 319 ren.setUseTitle(useLabels); 320 ren.clear(); 321 ren.setEnabled(true); 322 ren.connect(editor, env); 323 324 return ren.getComponent(); 325 } 326 327 private ButtonPanel buttonPanel() { 328 if (buttonPanel == null) { 329 buttonPanel = new ButtonPanel(); 330 } 331 332 buttonPanel.setEnabled(true); 333 334 return buttonPanel; 335 } 336 337 private IconPanel iconPanel() { 338 if (iconPanel == null) { 339 iconPanel = new IconPanel(); 340 } 341 342 iconPanel.setEnabled(true); 343 344 return iconPanel; 345 } 346 347 350 private ComboboxRenderer comboboxRenderer() { 351 if (comboboxRenderer == null) { 352 comboboxRenderer = new ComboboxRenderer(tableUI); 353 354 ((JComponent ) comboboxRenderer).setName( 356 "ComboboxRenderer for " + getClass().getName() + "@" + System.identityHashCode(this) 357 ); } 359 360 return comboboxRenderer; 361 } 362 363 366 private StringRenderer stringRenderer() { 367 if (stringRenderer == null) { 368 stringRenderer = new StringRenderer(tableUI); 369 370 ((JComponent ) stringRenderer).setName( 372 "StringRenderer for " + getClass().getName() + "@" + System.identityHashCode(this) 373 ); } 375 376 return stringRenderer; 377 } 378 379 382 private CheckboxRenderer checkboxRenderer() { 383 if (checkboxRenderer == null) { 384 checkboxRenderer = new CheckboxRenderer(); 385 386 ((JComponent ) checkboxRenderer).setName( 388 "CheckboxRenderer for " + getClass().getName() + "@" + System.identityHashCode(this) 389 ); } 391 392 return checkboxRenderer; 393 } 394 395 398 private RadioRenderer radioRenderer() { 399 if (radioRenderer == null) { 400 radioRenderer = new RadioRenderer(tableUI); 401 402 ((JComponent ) radioRenderer).setName( 404 "RadioRenderer for " + getClass().getName() + "@" + System.identityHashCode(this) 405 ); } 407 408 return radioRenderer; 409 } 410 411 414 private TextFieldRenderer textFieldRenderer() { 415 if (textFieldRenderer == null) { 416 textFieldRenderer = new TextFieldRenderer(); 417 } 418 419 return textFieldRenderer; 420 } 421 422 428 private static String makeDisplayble(String str, Font f) { 429 if (null == str) { 430 return str; 431 } 432 433 if (null == f) { 434 f = new JLabel ().getFont(); 435 } 436 437 StringBuffer buf = new StringBuffer (str.length() * 6); char[] chars = str.toCharArray(); 439 440 for (int i = 0; i < chars.length; i++) { 441 char c = chars[i]; 442 443 switch (c) { 444 case '\t': 446 buf.append(" "); break; 448 449 case '\n': 450 break; 451 452 case '\r': 453 break; 454 455 case '\b': 456 buf.append("\\b"); 457 458 break; 460 case '\f': 461 buf.append("\\f"); 462 463 break; 465 default: 466 467 if ((null == f) || f.canDisplay(c)) { 468 buf.append(c); 469 } else { 470 buf.append("\\u"); 472 String hex = Integer.toHexString(c); 473 474 for (int j = 0; j < (4 - hex.length()); j++) 475 buf.append('0'); 476 477 buf.append(hex); 478 } 479 } 480 } 481 482 return buf.toString(); 483 } 484 485 static final class ComboboxRenderer extends ComboInplaceEditor { 486 private Object item = null; 487 boolean editable = false; 488 489 public ComboboxRenderer(boolean tableUI) { 490 super(tableUI); 491 } 492 493 public boolean isEditable() { 494 return false; 495 } 496 497 498 public void paintComponent(Graphics g) { 499 setEnabled(isEnabled() && env.isEditable()); 500 501 doLayout(); super.paintComponent(g); 505 506 clear(); 508 } 509 510 public void clear() { 511 super.clear(); 512 item = null; 513 } 514 515 public void setSelectedItem(Object o) { 516 item = o; 517 518 if ((item == null) && (editor != null) && (editor.getTags().length > 0)) { 519 item = editor.getTags()[0]; 520 } 521 522 if (editable) { 523 getEditor().setItem(getSelectedItem()); 524 } 525 } 526 527 public Object getSelectedItem() { 528 return item; 529 } 530 531 public void installAncestorListener() { 532 } 534 535 536 public void processFocusEvent(FocusEvent fe) { 537 } 539 540 public void processMouseEvent(MouseEvent me) { 541 } 543 544 545 public void addActionListener(ActionListener ae) { 546 } 547 548 549 protected void fireActionPerformed(ActionEvent ae) { 550 } 551 552 553 protected void fireStateChanged() { 554 } 555 556 557 protected void firePropertyChange(String name, Object old, Object nue) { 558 super.firePropertyChange(name, old, nue); 560 } 561 } 562 563 private static final class CheckboxRenderer extends CheckboxInplaceEditor { 564 565 public void paintComponent(Graphics g) { 566 setEnabled(PropUtils.checkEnabled(this, editor, env)); 567 super.paintComponent(g); 568 clear(); 569 } 570 571 572 protected void fireActionPerformed(ActionEvent ae) { 573 } 574 575 576 protected void fireStateChanged() { 577 } 578 579 580 protected void firePropertyChange(String name, Object old, Object nue) { 581 if ("foreground".equals(name) || "background".equals(name) || "font".equals(name)) { super.firePropertyChange(name, old, nue); 584 } 585 } 586 587 588 public void firePropertyChange(String name, boolean old, boolean nue) { 589 } 590 591 592 public void firePropertyChange(String name, int old, int nue) { 593 } 594 595 596 public void firePropertyChange(String name, byte old, byte nue) { 597 } 598 599 600 public void firePropertyChange(String name, char old, char nue) { 601 } 602 603 604 public void firePropertyChange(String name, double old, double nue) { 605 } 606 607 608 public void firePropertyChange(String name, float old, float nue) { 609 } 610 611 612 public void firePropertyChange(String name, short old, short nue) { 613 } 614 } 615 616 618 private static final class StringRenderer extends JLabel implements InplaceEditor { 619 private PropertyEditor editor = null; 620 private PropertyEnv env = null; 621 private boolean tableUI = false; 622 private boolean enabled = true; 623 private JLabel htmlLabel = HtmlRenderer.createLabel(); 624 private JLabel noHtmlLabel = new JLabel (); 625 private Object value = null; 626 627 public StringRenderer(boolean tableUI) { 628 this.tableUI = tableUI; 629 setOpaque(true); 630 ((HtmlRenderer.Renderer) htmlLabel).setRenderStyle(HtmlRenderer.STYLE_TRUNCATE); 631 } 632 633 635 public void setEnabled(boolean val) { 636 enabled = val; 637 } 638 639 public void setText(String s) { 640 if (s != null) { 641 if (s.length() > 512) { 642 super.setText(makeDisplayble(s.substring(0, 512), getFont())); 644 } else { 645 super.setText(makeDisplayble(s, getFont())); 646 } 647 } else { 648 super.setText(""); } 650 } 651 652 654 public boolean isEnabled() { 655 return enabled; 656 } 657 658 659 protected void firePropertyChange(String name, Object old, Object nue) { 660 } 662 663 public void validate() { 664 } 666 667 public void invalidate() { 668 } 670 671 public void revalidate() { 672 } 674 675 public void repaint() { 676 } 678 679 public void repaint(long tm, int x, int y, int w, int h) { 680 } 682 683 public Dimension getPreferredSize() { 684 if (getText().length() > 1024) { 685 return new Dimension (4196, PropUtils.getMinimumPropPanelHeight()); 688 } 689 690 Dimension result = super.getPreferredSize(); 691 result.width = Math.max(result.width, PropUtils.getMinimumPropPanelWidth()); 692 693 result.height = Math.max(result.height, PropUtils.getMinimumPropPanelHeight()); 694 695 return result; 696 } 697 698 public void paint(Graphics g) { 699 if (editor != null) { 700 setEnabled(PropUtils.checkEnabled(this, editor, env)); 701 } 702 703 if (editor instanceof ExceptionPropertyEditor) { 704 setForeground(PropUtils.getErrorColor()); 705 } 706 707 if ((editor != null) && editor.isPaintable()) { 708 delegatedPaint(g); 709 } else { 710 String htmlDisplayValue = (env == null) ? null : 711 (String ) env.getFeatureDescriptor().getValue("htmlDisplayValue"); boolean htmlValueUsed = htmlDisplayValue != null; 713 714 JLabel lbl = htmlValueUsed ? htmlLabel : noHtmlLabel; 715 String text = htmlValueUsed ? htmlDisplayValue : getText(); 716 717 if (text == null) { 718 text = ""; } else { 720 text = makeDisplayble( text, getFont() ); 721 } 722 723 if (htmlValueUsed) { 724 ((HtmlRenderer.Renderer) lbl).setHtml(text.length() < 512); 726 } 727 728 lbl.setFont(getFont()); 729 lbl.setEnabled(isEnabled()); 730 lbl.setText(text); 732 if (!htmlValueUsed) { 733 lbl.putClientProperty("html", null); } 735 736 lbl.setIcon(getIcon()); 737 lbl.setIconTextGap(getIconTextGap()); 738 lbl.setBounds(getBounds()); 739 lbl.setOpaque(true); 740 lbl.setBackground(getBackground()); 741 lbl.setForeground(getForeground()); 742 lbl.setBorder( getBorder() ); 743 lbl.paint(g); 744 } 745 746 clear(); 747 } 748 749 private void delegatedPaint(Graphics g) { 750 Color c = g.getColor(); 751 752 try { 753 g.setColor(getBackground()); 754 g.fillRect(0, 0, getWidth(), getHeight()); 755 g.setColor(getForeground()); 756 757 if (!tableUI) { 758 Border b = BorderFactory.createBevelBorder(BevelBorder.LOWERED); 761 b.paintBorder(this, g, 0, 0, getWidth(), getHeight()); 762 } 763 764 Rectangle r = getBounds(); 765 766 r.x = (getWidth() > 16) ? ((editor instanceof Boolean3WayEditor) ? 0 : 3) : 0; r.width -= ((getWidth() > 16) ? ((editor instanceof Boolean3WayEditor) ? 0 : 3) : 0); r.y = 0; 771 editor.paintValue(g, r); 772 } finally { 773 g.setColor(c); 774 } 775 } 776 777 public void clear() { 778 editor = null; 779 env = null; 780 setIcon(null); 781 setOpaque(true); 782 } 783 784 public void setValue(Object o) { 785 value = o; 786 setText((value instanceof String ) ? (String ) value : ((value != null) ? value.toString() : null)); 787 } 788 789 public void connect(PropertyEditor p, PropertyEnv env) { 790 editor = p; 791 this.env = env; 792 reset(); 793 } 794 795 public JComponent getComponent() { 796 return this; 797 } 798 799 public KeyStroke [] getKeyStrokes() { 800 return null; 801 } 802 803 public PropertyEditor getPropertyEditor() { 804 return editor; 805 } 806 807 public PropertyModel getPropertyModel() { 808 return null; 809 } 810 811 public Object getValue() { 812 return getText(); 813 } 814 815 public void handleInitialInputEvent(java.awt.event.InputEvent e) { 816 } 818 819 public boolean isKnownComponent(Component c) { 820 return false; 821 } 822 823 public void removeActionListener(ActionListener al) { 824 } 826 827 public void reset() { 828 setText(editor.getAsText()); 829 830 Image i = null; 831 832 if (env != null) { 833 if (env.getState() == env.STATE_INVALID) { 834 setForeground(PropUtils.getErrorColor()); 835 i = Utilities.loadImage("org/openide/resources/propertysheet/invalid.gif"); } else { 837 Object o = env.getFeatureDescriptor().getValue("valueIcon"); 839 if (o instanceof Icon ) { 840 setIcon((Icon ) o); 841 } else if (o instanceof Image ) { 842 i = (Image ) o; 843 } 844 } 845 } 846 847 if (i != null) { 848 setIcon(new ImageIcon (i)); 849 } 850 } 851 852 public void setPropertyModel(PropertyModel pm) { 853 } 855 856 public boolean supportsTextEntry() { 857 return false; 858 } 859 860 861 protected void fireActionPerformed(ActionEvent ae) { 862 } 863 864 865 protected void fireStateChanged() { 866 } 867 868 public void addActionListener(ActionListener al) { 869 } 871 } 872 873 875 private static final class TextFieldRenderer extends StringInplaceEditor { 876 public void paintComponent(Graphics g) { 877 setEnabled(PropUtils.checkEnabled(this, editor, env)); 878 super.paintComponent(g); 879 clear(); 880 } 881 882 883 protected void fireActionPerformed(ActionEvent ae) { 884 } 885 886 887 protected void fireStateChanged() { 888 } 889 890 891 protected void firePropertyChange(String name, Object old, Object nue) { 892 boolean fire = ("locale".equals(name)) || ("document".equals(name)); 895 if (fire) { 896 super.firePropertyChange(name, old, nue); 897 } 898 } 899 } 900 901 private static final class RadioRenderer extends RadioInplaceEditor { 902 private boolean needLayout = true; 903 904 public RadioRenderer(boolean tableUI) { 905 super(tableUI); 906 } 907 908 public void connect(PropertyEditor pe, PropertyEnv env) { 909 super.connect(pe, env); 910 needLayout = true; 911 } 912 913 public void paint(Graphics g) { 914 if (needLayout) { 915 getLayout().layoutContainer(this); 916 needLayout = false; 917 } 918 919 super.paint(g); 921 clear(); 922 } 923 924 926 protected InvRadioButton createButton() { 927 return new NoEventsInvRadioButton(); 928 } 929 930 931 protected void configureButton(InvRadioButton ire, String txt) { 932 if (editor.getTags().length == 1) { 933 ire.setEnabled(false); 934 } else { 935 ire.setEnabled(isEnabled()); 936 } 937 938 ire.setText(txt); 939 ire.setForeground(getForeground()); 940 ire.setBackground(getBackground()); 941 ire.setFont(getFont()); 942 943 if (txt.equals(editor.getAsText())) { 944 ire.setSelected(true); 945 } else { 946 ire.setSelected(false); 947 } 948 } 949 950 951 public void addContainerListener(ContainerListener cl) { 952 } 953 954 955 public void addChangeListener(ChangeListener cl) { 956 } 957 958 959 public void addComponentListener(ComponentListener l) { 960 } 961 962 963 public void addHierarchyBoundsListener(HierarchyBoundsListener hbl) { 964 } 965 966 967 public void addHierarchyListener(HierarchyListener hl) { 968 } 969 970 971 protected void firePropertyChange(String name, Object old, Object nue) { 972 } 973 974 975 public void firePropertyChange(String name, boolean old, boolean nue) { 976 } 977 978 979 public void firePropertyChange(String name, int old, int nue) { 980 } 981 982 983 public void firePropertyChange(String name, byte old, byte nue) { 984 } 985 986 987 public void firePropertyChange(String name, char old, char nue) { 988 } 989 990 991 public void firePropertyChange(String name, double old, double nue) { 992 } 993 994 995 public void firePropertyChange(String name, float old, float nue) { 996 } 997 998 999 public void firePropertyChange(String name, short old, short nue) { 1000 } 1001 1002 private class NoEventsInvRadioButton extends InvRadioButton { 1003 1004 public void addActionListener(ActionListener al) { 1005 } 1006 1007 1008 public void addContainerListener(ContainerListener cl) { 1009 } 1010 1011 1012 public void addChangeListener(ChangeListener cl) { 1013 } 1014 1015 1016 public void addComponentListener(ComponentListener l) { 1017 } 1018 1019 1020 public void addHierarchyBoundsListener(HierarchyBoundsListener hbl) { 1021 } 1022 1023 1024 public void addHierarchyListener(HierarchyListener hl) { 1025 } 1026 1027 1028 protected void fireActionPerformed(ActionEvent ae) { 1029 } 1030 1031 1032 protected void fireStateChanged() { 1033 } 1034 1035 1036 protected void firePropertyChange(String name, Object old, Object nue) { 1037 } 1038 1039 1040 public void firePropertyChange(String name, boolean old, boolean nue) { 1041 } 1042 1043 1044 public void firePropertyChange(String name, int old, int nue) { 1045 } 1046 1047 1048 public void firePropertyChange(String name, byte old, byte nue) { 1049 } 1050 1051 1052 public void firePropertyChange(String name, char old, char nue) { 1053 } 1054 1055 1056 public void firePropertyChange(String name, double old, double nue) { 1057 } 1058 1059 1060 public void firePropertyChange(String name, float old, float nue) { 1061 } 1062 1063 1064 public void firePropertyChange(String name, short old, short nue) { 1065 } 1066 } 1067 } 1068 1069 private static final class ExceptionPropertyEditor implements PropertyEditor { 1070 Exception e; 1071 1072 public ExceptionPropertyEditor(Exception e) { 1073 this.e = e; 1074 } 1075 1076 public void addPropertyChangeListener(java.beans.PropertyChangeListener listener) { 1077 } 1079 1080 public String getAsText() { 1081 return e.getMessage(); 1082 } 1083 1084 public java.awt.Component getCustomEditor() { 1085 return null; 1086 } 1087 1088 public String getJavaInitializationString() { 1089 return null; 1090 } 1091 1092 public String [] getTags() { 1093 return null; 1094 } 1095 1096 public Object getValue() { 1097 return e; 1098 } 1099 1100 public boolean isPaintable() { 1101 return false; 1102 } 1103 1104 public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) { 1105 } 1107 1108 public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) { 1109 } 1111 1112 public void setAsText(String text) throws java.lang.IllegalArgumentException { 1113 } 1115 1116 public void setValue(Object value) { 1117 } 1119 1120 public boolean supportsCustomEditor() { 1121 return false; 1122 } 1123 } 1124 1125 1127 private class ExceptionRenderer extends JLabel implements InplaceEditor { 1128 public void addActionListener(ActionListener al) { 1129 } 1131 1132 public Color getForeground() { 1133 return PropUtils.getErrorColor(); 1134 } 1135 1136 public void clear() { 1137 } 1139 1140 public void connect(PropertyEditor pe, org.openide.explorer.propertysheet.PropertyEnv env) { 1141 } 1143 1144 public JComponent getComponent() { 1145 return this; 1146 } 1147 1148 public KeyStroke [] getKeyStrokes() { 1149 return null; 1150 } 1151 1152 public PropertyEditor getPropertyEditor() { 1153 return null; 1154 } 1155 1156 public org.openide.explorer.propertysheet.PropertyModel getPropertyModel() { 1157 return null; 1158 } 1159 1160 public Object getValue() { 1161 return getText(); 1162 } 1163 1164 public boolean isKnownComponent(Component c) { 1165 return c == this; 1166 } 1167 1168 public void removeActionListener(ActionListener al) { 1169 } 1171 1172 public void reset() { 1173 } 1175 1176 public void setPropertyModel(org.openide.explorer.propertysheet.PropertyModel pm) { 1177 } 1179 1180 public void setValue(Object o) { 1181 } 1183 1184 public boolean supportsTextEntry() { 1185 return false; 1186 } 1187 } 1188} 1189 | Popular Tags |