home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1998 September / dppcpro0998.iso / Rwc / Sybase / Install.exe / java.z / CustomPropertyEditorForm.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-03-23  |  2.9 KB  |  109 lines

  1. package powersoft.painter;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Container;
  5. import java.awt.Dialog;
  6. import java.awt.Dimension;
  7. import java.awt.Frame;
  8. import java.awt.Insets;
  9. import java.awt.Rectangle;
  10. import java.awt.Window;
  11. import java.awt.event.WindowEvent;
  12. import java.awt.event.WindowListener;
  13. import java.beans.PropertyChangeEvent;
  14. import java.beans.PropertyChangeListener;
  15. import java.beans.PropertyEditor;
  16. import java.util.EventObject;
  17. import powersoft.powerj.ui.ResizePercentLayout;
  18.  
  19. public class CustomPropertyEditorForm extends Dialog implements WindowListener, PropertyChangeListener {
  20.    private ResizePercentLayout _layout;
  21.    private Rectangle _customEditorRect;
  22.  
  23.    public CustomPropertyEditorForm(Frame var1, String var2) {
  24.       super(var1, var2, false);
  25.       ((Dialog)this).setTitle(var2);
  26.       ((Dialog)this).addNotify();
  27.       ((Dialog)this).setResizable(true);
  28.       ((Window)this).addWindowListener(this);
  29.       this._layout = new ResizePercentLayout();
  30.       ((Container)this).setLayout(this._layout);
  31.    }
  32.  
  33.    public CustomPropertyEditorForm(Frame var1) {
  34.       super(var1, false);
  35.       ((Dialog)this).addNotify();
  36.       ((Dialog)this).setResizable(true);
  37.       ((Window)this).addWindowListener(this);
  38.       this._layout = new ResizePercentLayout();
  39.       ((Container)this).setLayout(this._layout);
  40.    }
  41.  
  42.    public void AddCustomPropertyEditor(PropertyEditor var1) {
  43.       var1.addPropertyChangeListener(this);
  44.    }
  45.  
  46.    public void AddCustomPropertyEditor(Component var1) {
  47.       boolean var2 = true;
  48.       if (((Container)this).getComponentCount() > 0) {
  49.          Component var3 = ((Container)this).getComponent(0);
  50.          this._customEditorRect = var3.getBounds();
  51.          this._layout.removeLayoutComponent(var3);
  52.          ((Container)this).remove(var3);
  53.          var2 = false;
  54.       }
  55.  
  56.       ((Container)this).add(var1);
  57.       this._layout.setResizePercent(var1, new Rectangle(0, 0, 100, 100));
  58.       if (var2) {
  59.          Dimension var6 = var1.getPreferredSize();
  60.          Insets var4 = ((Container)this).getInsets();
  61.          Rectangle var5 = ((Component)this).getBounds();
  62.          this._customEditorRect = new Rectangle();
  63.          var5.width = var6.width + var4.left + var4.right;
  64.          var5.height = var6.height + var4.top + var4.bottom;
  65.          ((Component)this).setBounds(var5);
  66.          this._customEditorRect.x = var4.left;
  67.          this._customEditorRect.y = var4.top;
  68.          this._customEditorRect.width = var6.width;
  69.          this._customEditorRect.height = var6.height;
  70.       }
  71.  
  72.       var1.setBounds(this._customEditorRect);
  73.       var1.setVisible(true);
  74.    }
  75.  
  76.    public void windowClosed(WindowEvent var1) {
  77.    }
  78.  
  79.    public void windowOpened(WindowEvent var1) {
  80.    }
  81.  
  82.    public void windowClosing(WindowEvent var1) {
  83.       Object var2 = ((EventObject)var1).getSource();
  84.       if (var2 == this) {
  85.          ((Component)this).setVisible(false);
  86.          ((Window)this).dispose();
  87.       }
  88.  
  89.    }
  90.  
  91.    public void windowIconified(WindowEvent var1) {
  92.    }
  93.  
  94.    public void windowActivated(WindowEvent var1) {
  95.    }
  96.  
  97.    public void windowDeiconified(WindowEvent var1) {
  98.    }
  99.  
  100.    public void windowDeactivated(WindowEvent var1) {
  101.    }
  102.  
  103.    public void propertyChange(PropertyChangeEvent var1) {
  104.       this.NotifyPropertyChanged(((EventObject)var1).getSource(), var1.getPropertyName());
  105.    }
  106.  
  107.    native void NotifyPropertyChanged(Object var1, String var2);
  108. }
  109.