home *** CD-ROM | disk | FTP | other *** search
- package powersoft.painter;
-
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dialog;
- import java.awt.Dimension;
- import java.awt.Frame;
- import java.awt.Insets;
- import java.awt.Rectangle;
- import java.awt.Window;
- import java.awt.event.WindowEvent;
- import java.awt.event.WindowListener;
- import java.beans.PropertyChangeEvent;
- import java.beans.PropertyChangeListener;
- import java.beans.PropertyEditor;
- import java.util.EventObject;
- import powersoft.powerj.ui.ResizePercentLayout;
-
- public class CustomPropertyEditorForm extends Dialog implements WindowListener, PropertyChangeListener {
- private ResizePercentLayout _layout;
- private Rectangle _customEditorRect;
-
- public CustomPropertyEditorForm(Frame var1, String var2) {
- super(var1, var2, false);
- ((Dialog)this).setTitle(var2);
- ((Dialog)this).addNotify();
- ((Dialog)this).setResizable(true);
- ((Window)this).addWindowListener(this);
- this._layout = new ResizePercentLayout();
- ((Container)this).setLayout(this._layout);
- }
-
- public CustomPropertyEditorForm(Frame var1) {
- super(var1, false);
- ((Dialog)this).addNotify();
- ((Dialog)this).setResizable(true);
- ((Window)this).addWindowListener(this);
- this._layout = new ResizePercentLayout();
- ((Container)this).setLayout(this._layout);
- }
-
- public void AddCustomPropertyEditor(PropertyEditor var1) {
- var1.addPropertyChangeListener(this);
- }
-
- public void AddCustomPropertyEditor(Component var1) {
- boolean var2 = true;
- if (((Container)this).getComponentCount() > 0) {
- Component var3 = ((Container)this).getComponent(0);
- this._customEditorRect = var3.getBounds();
- this._layout.removeLayoutComponent(var3);
- ((Container)this).remove(var3);
- var2 = false;
- }
-
- ((Container)this).add(var1);
- this._layout.setResizePercent(var1, new Rectangle(0, 0, 100, 100));
- if (var2) {
- Dimension var6 = var1.getPreferredSize();
- Insets var4 = ((Container)this).getInsets();
- Rectangle var5 = ((Component)this).getBounds();
- this._customEditorRect = new Rectangle();
- var5.width = var6.width + var4.left + var4.right;
- var5.height = var6.height + var4.top + var4.bottom;
- ((Component)this).setBounds(var5);
- this._customEditorRect.x = var4.left;
- this._customEditorRect.y = var4.top;
- this._customEditorRect.width = var6.width;
- this._customEditorRect.height = var6.height;
- }
-
- var1.setBounds(this._customEditorRect);
- var1.setVisible(true);
- }
-
- public void windowClosed(WindowEvent var1) {
- }
-
- public void windowOpened(WindowEvent var1) {
- }
-
- public void windowClosing(WindowEvent var1) {
- Object var2 = ((EventObject)var1).getSource();
- if (var2 == this) {
- ((Component)this).setVisible(false);
- ((Window)this).dispose();
- }
-
- }
-
- public void windowIconified(WindowEvent var1) {
- }
-
- public void windowActivated(WindowEvent var1) {
- }
-
- public void windowDeiconified(WindowEvent var1) {
- }
-
- public void windowDeactivated(WindowEvent var1) {
- }
-
- public void propertyChange(PropertyChangeEvent var1) {
- this.NotifyPropertyChanged(((EventObject)var1).getSource(), var1.getPropertyName());
- }
-
- native void NotifyPropertyChanged(Object var1, String var2);
- }
-