/[classpath]/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by tromey, Sat Jun 4 19:16:11 2005 UTC revision 1.8 by abalkiss, Wed Jun 22 15:09:40 2005 UTC
# Line 53  import java.awt.event.ComponentListener; Line 53  import java.awt.event.ComponentListener;
53  import java.awt.event.MouseEvent;  import java.awt.event.MouseEvent;
54  import java.beans.PropertyChangeEvent;  import java.beans.PropertyChangeEvent;
55  import java.beans.PropertyChangeListener;  import java.beans.PropertyChangeListener;
56    import java.beans.PropertyVetoException;
57    import java.beans.VetoableChangeListener;
58    
59  import javax.swing.DefaultDesktopManager;  import javax.swing.DefaultDesktopManager;
60  import javax.swing.DesktopManager;  import javax.swing.DesktopManager;
# Line 864  public class BasicInternalFrameUI extend Line 866  public class BasicInternalFrameUI extend
866     * JInternalFrame.     * JInternalFrame.
867     */     */
868    public class InternalFramePropertyChangeListener    public class InternalFramePropertyChangeListener
869      implements PropertyChangeListener      implements PropertyChangeListener, VetoableChangeListener
870    {    {
871    
872        /**
873         * This method is called when one of the JInternalFrame's properties
874         * change.  This method is to allow JInternalFrame to veto an attempt
875         * to close the internal frame.  This allows JInternalFrame to honour
876         * its defaultCloseOperation if that is DO_NOTHING_ON_CLOSE.
877         */
878        public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException
879        {
880          if (e.getPropertyName().equals(JInternalFrame.IS_CLOSED_PROPERTY))
881            {
882              if (frame.getDefaultCloseOperation() == JInternalFrame.HIDE_ON_CLOSE)
883                frame.setVisible(false);
884              else if (frame.getDefaultCloseOperation() == JInternalFrame.DISPOSE_ON_CLOSE)
885                closeFrame(frame);
886              else
887                throw new PropertyVetoException ("close operation is DO_NOTHING_ON_CLOSE\n", e);
888            }
889        }
890        
891      /**      /**
892       * This method is called when one of the JInternalFrame's properties       * This method is called when one of the JInternalFrame's properties
893       * change.       * change.
# Line 881  public class BasicInternalFrameUI extend Line 903  public class BasicInternalFrameUI extend
903            else            else
904              minimizeFrame(frame);              minimizeFrame(frame);
905          }          }
       else if (evt.getPropertyName().equals(JInternalFrame.IS_CLOSED_PROPERTY))  
         closeFrame(frame);  
906        else if (evt.getPropertyName().equals(JInternalFrame.IS_ICON_PROPERTY))        else if (evt.getPropertyName().equals(JInternalFrame.IS_ICON_PROPERTY))
907          {          {
908            if (frame.isIcon())            if (frame.isIcon())
# Line 1031  public class BasicInternalFrameUI extend Line 1051  public class BasicInternalFrameUI extend
1051     */     */
1052    protected PropertyChangeListener propertyChangeListener;    protected PropertyChangeListener propertyChangeListener;
1053    
1054      /**
1055       * The VetoableChangeListener.  Listens to PropertyChangeEvents
1056       * from the JInternalFrame and allows the JInternalFrame to
1057       * veto attempts to close it.
1058       */
1059      private VetoableChangeListener internalFrameVetoableChangeListener;
1060    
1061    /** The InternalFrameListener that listens to the JInternalFrame. */    /** The InternalFrameListener that listens to the JInternalFrame. */
1062    private transient BasicInternalFrameListener internalFrameListener;    private transient BasicInternalFrameListener internalFrameListener;
1063    
# Line 1171  public class BasicInternalFrameUI extend Line 1198  public class BasicInternalFrameUI extend
1198      borderListener = createBorderListener(frame);      borderListener = createBorderListener(frame);
1199      componentListener = createComponentListener();      componentListener = createComponentListener();
1200      propertyChangeListener = createPropertyChangeListener();      propertyChangeListener = createPropertyChangeListener();
1201        internalFrameVetoableChangeListener = new InternalFramePropertyChangeListener();
1202    
1203      frame.addMouseListener(borderListener);      frame.addMouseListener(borderListener);
1204      frame.addMouseMotionListener(borderListener);      frame.addMouseMotionListener(borderListener);
1205      frame.addInternalFrameListener(internalFrameListener);      frame.addInternalFrameListener(internalFrameListener);
1206      frame.addPropertyChangeListener(propertyChangeListener);      frame.addPropertyChangeListener(propertyChangeListener);
1207        frame.addVetoableChangeListener(internalFrameVetoableChangeListener);
1208      frame.getRootPane().getGlassPane().addMouseListener(glassPaneDispatcher);      frame.getRootPane().getGlassPane().addMouseListener(glassPaneDispatcher);
1209      frame.getRootPane().getGlassPane().addMouseMotionListener(glassPaneDispatcher);      frame.getRootPane().getGlassPane().addMouseMotionListener(glassPaneDispatcher);
1210    }    }
# Line 1552  public class BasicInternalFrameUI extend Line 1580  public class BasicInternalFrameUI extend
1580     */     */
1581    protected DesktopManager getDesktopManager()    protected DesktopManager getDesktopManager()
1582    {    {
1583      DesktopManager value = frame.getDesktopPane().getDesktopManager();      DesktopManager value = null;
1584        JDesktopPane pane = frame.getDesktopPane();
1585        if (pane != null)
1586          value = frame.getDesktopPane().getDesktopManager();
1587      if (value == null)      if (value == null)
1588        value = createDesktopManager();        value = createDesktopManager();
1589      return value;      return value;

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26