home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 144 / DPCS0200.iso / Internet / Supanet / system / swing.jar / javax / swing / plaf / basic / BasicComboBoxUI$PropertyChangeHandler.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-05  |  3.3 KB  |  104 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.beans.PropertyChangeEvent;
  4. import java.beans.PropertyChangeListener;
  5. import javax.swing.ComboBoxModel;
  6.  
  7. public class BasicComboBoxUI$PropertyChangeHandler implements PropertyChangeListener {
  8.    // $FF: synthetic field
  9.    private final BasicComboBoxUI this$0;
  10.  
  11.    public BasicComboBoxUI$PropertyChangeHandler(BasicComboBoxUI var1) {
  12.       this.this$0 = var1;
  13.    }
  14.  
  15.    public void propertyChange(PropertyChangeEvent var1) {
  16.       String var2 = var1.getPropertyName();
  17.       if (var2.equals("model")) {
  18.          ComboBoxModel var3 = (ComboBoxModel)var1.getNewValue();
  19.          ComboBoxModel var4 = (ComboBoxModel)var1.getOldValue();
  20.          if (var4 != null && this.this$0.listDataListener != null) {
  21.             var4.removeListDataListener(this.this$0.listDataListener);
  22.          }
  23.  
  24.          if (var3 != null && this.this$0.listDataListener != null) {
  25.             var3.addListDataListener(this.this$0.listDataListener);
  26.          }
  27.  
  28.          if (this.this$0.editor != null) {
  29.             this.this$0.comboBox.configureEditor(this.this$0.comboBox.getEditor(), this.this$0.comboBox.getSelectedItem());
  30.          }
  31.  
  32.          this.this$0.isMinimumSizeDirty = true;
  33.          this.this$0.comboBox.revalidate();
  34.          this.this$0.comboBox.repaint();
  35.       } else if (var2.equals("editor") && this.this$0.comboBox.isEditable()) {
  36.          this.this$0.removeEditor();
  37.          this.this$0.addEditor();
  38.       } else if (var2.equals("editable")) {
  39.          if (this.this$0.comboBox.isEditable()) {
  40.             this.this$0.comboBox.setRequestFocusEnabled(false);
  41.             if (this.this$0.popupKeyListener != null) {
  42.                this.this$0.comboBox.removeKeyListener(this.this$0.popupKeyListener);
  43.             }
  44.  
  45.             this.this$0.addEditor();
  46.             if (this.this$0.editor != null) {
  47.                this.this$0.configureEditor();
  48.             }
  49.          } else {
  50.             this.this$0.comboBox.setRequestFocusEnabled(true);
  51.             if (this.this$0.popupKeyListener != null) {
  52.                this.this$0.comboBox.addKeyListener(this.this$0.popupKeyListener);
  53.             }
  54.  
  55.             this.this$0.removeEditor();
  56.          }
  57.  
  58.          this.this$0.comboBox.revalidate();
  59.          this.this$0.comboBox.validate();
  60.          this.this$0.comboBox.revalidate();
  61.          this.this$0.comboBox.repaint();
  62.       } else if (var2.equals("enabled")) {
  63.          boolean var5 = this.this$0.comboBox.isEnabled();
  64.          if (var5) {
  65.             if (this.this$0.editor != null) {
  66.                this.this$0.editor.setEnabled(true);
  67.             }
  68.  
  69.             if (this.this$0.arrowButton != null) {
  70.                this.this$0.arrowButton.setEnabled(true);
  71.             }
  72.          } else {
  73.             if (this.this$0.editor != null) {
  74.                this.this$0.editor.setEnabled(false);
  75.             }
  76.  
  77.             if (this.this$0.arrowButton != null) {
  78.                this.this$0.arrowButton.setEnabled(false);
  79.             }
  80.          }
  81.  
  82.          this.this$0.comboBox.repaint();
  83.       } else if (var2.equals("maximumRowCount")) {
  84.          if (this.this$0.isPopupVisible(this.this$0.comboBox)) {
  85.             this.this$0.setPopupVisible(this.this$0.comboBox, false);
  86.             this.this$0.setPopupVisible(this.this$0.comboBox, true);
  87.          }
  88.       } else if (var2.equals("font")) {
  89.          this.this$0.listBox.setFont(this.this$0.comboBox.getFont());
  90.          if (this.this$0.editor != null) {
  91.             this.this$0.editor.setFont(this.this$0.comboBox.getFont());
  92.          }
  93.       } else if (var2.equals("JComboBox.lightweightKeyboardNavigation")) {
  94.          Object var6 = var1.getNewValue();
  95.          if (var6.equals("Lightweight")) {
  96.             BasicComboBoxUI.access$1(this.this$0, true);
  97.          } else if (var6.equals("Heavyweight")) {
  98.             BasicComboBoxUI.access$1(this.this$0, false);
  99.          }
  100.       }
  101.  
  102.    }
  103. }
  104.