/[classpath]/classpath/javax/swing/DefaultDesktopManager.java
ViewVC logotype

Diff of /classpath/javax/swing/DefaultDesktopManager.java

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

revision 1.9 by mkoch, Wed Jan 26 20:57:45 2005 UTC revision 1.10 by rabbit78, Mon Jun 20 14:35:53 2005 UTC
# Line 189  public class DefaultDesktopManager imple Line 189  public class DefaultDesktopManager imple
189        p.setSelectedFrame(frame);        p.setSelectedFrame(frame);
190      else      else
191        {        {
192          try          try
193            {            {
194              frame.setSelected(true);              frame.setSelected(true);
195            }            }
196          catch (PropertyVetoException e)          catch (PropertyVetoException e)
197            {            {
198              // Do nothing.              // Do nothing.
199            }            }
200        }        }
201    
202      setBoundsForFrame(frame, normalBounds.x, normalBounds.y,      setBoundsForFrame(frame, normalBounds.x, normalBounds.y,
# Line 217  public class DefaultDesktopManager imple Line 217  public class DefaultDesktopManager imple
217        p.setSelectedFrame(null);        p.setSelectedFrame(null);
218      else      else
219        {        {
220          try          try
221            {            {
222              frame.setSelected(false);              frame.setSelected(false);
223            }            }
224          catch (PropertyVetoException e)          catch (PropertyVetoException e)
225            {            {
226            }            }
227        }        }
228    
229      Container c = frame.getParent();      Container c = frame.getParent();
230    
231      if (! wasIcon(frame))      if (!wasIcon(frame))
232        {        {
233          Rectangle r = getBoundsForIconOf(frame);          Rectangle r = getBoundsForIconOf(frame);
234          icon.setBounds(r);          icon.setBounds(r);
235          setWasIcon(frame, Boolean.TRUE);          setWasIcon(frame, Boolean.TRUE);
236        }        }
237    
238      if (c != null)      if (c != null)
239        {        {
240          if (icon != null)          if (icon != null)
241            {            {
242              c.add(icon);              c.add(icon);
243              icon.setVisible(true);              icon.setVisible(true);
244            }            }
245          c.remove(frame);          c.remove(frame);
246        }        }
247    }    }
248    
# Line 261  public class DefaultDesktopManager imple Line 261  public class DefaultDesktopManager imple
261      c.add(frame);      c.add(frame);
262      frame.setVisible(true);      frame.setVisible(true);
263    
264      if (! frame.isSelected())      if (!frame.isSelected())
265        {        {
266          JDesktopPane p = frame.getDesktopPane();          JDesktopPane p = frame.getDesktopPane();
267          if (p != null)          if (p != null)
268            p.setSelectedFrame(frame);            p.setSelectedFrame(frame);
269          else          else
270            {            {
271              try              try
272                {                {
273                  frame.setSelected(true);                  frame.setSelected(true);
274                }                }
275              catch (PropertyVetoException e)              catch (PropertyVetoException e)
276                {                {
277                  // Do nothing.                  // Do nothing.
278                }                }
279            }            }
280        }        }
281    
282      c.invalidate();      c.invalidate();
# Line 296  public class DefaultDesktopManager imple Line 296  public class DefaultDesktopManager imple
296        p.setSelectedFrame(frame);        p.setSelectedFrame(frame);
297      else      else
298        {        {
299          try          try
300            {            {
301              frame.setSelected(true);              frame.setSelected(true);
302            }            }
303          catch (PropertyVetoException e)          catch (PropertyVetoException e)
304            {            {
305            }            }
306        }        }
307    
308      frame.toFront();      frame.toFront();
# Line 318  public class DefaultDesktopManager imple Line 318  public class DefaultDesktopManager imple
318      JDesktopPane p = frame.getDesktopPane();      JDesktopPane p = frame.getDesktopPane();
319      if (p != null)      if (p != null)
320        {        {
321          if (p.getSelectedFrame() == frame)          if (p.getSelectedFrame() == frame)
322            p.setSelectedFrame(null);            p.setSelectedFrame(null);
323        }        }
324      else      else
325        {        {
326          try          try
327            {            {
328              frame.setSelected(false);              frame.setSelected(false);
329            }            }
330          catch (PropertyVetoException e)          catch (PropertyVetoException e)
331            {            {
332            }            }
333        }        }
334    }    }
335    
# Line 361  public class DefaultDesktopManager imple Line 361  public class DefaultDesktopManager imple
361     * This method is called to drag the JInternalFrame to a new location.     * This method is called to drag the JInternalFrame to a new location.
362     *     *
363     * @param component The JComponent to drag, usually a JInternalFrame.     * @param component The JComponent to drag, usually a JInternalFrame.
364       *
365     * @param newX The new x coordinate.     * @param newX The new x coordinate.
366     * @param newY The new y coordinate.     * @param newY The new y coordinate.
367     */     */
# Line 368  public class DefaultDesktopManager imple Line 369  public class DefaultDesktopManager imple
369    {    {
370      if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE)      if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE)
371        {        {
372          // FIXME: Do outline drag mode painting.          // FIXME: Do outline drag mode painting.
373        }        }
374      else      else
375        {        {
376          Rectangle b = component.getBounds();          Rectangle b = component.getBounds();
377          if (component instanceof JDesktopIcon)          if (component instanceof JDesktopIcon)
378            component.setBounds(newX, newY, b.width, b.height);            component.setBounds(newX, newY, b.width, b.height);
379          else          else
380            setBoundsForFrame((JInternalFrame) component, newX, newY, b.width,            setBoundsForFrame((JInternalFrame) component, newX, newY, b.width,
381                              b.height);                              b.height);
382        }        }
383    }    }
384    
# Line 391  public class DefaultDesktopManager imple Line 392  public class DefaultDesktopManager imple
392    {    {
393      if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE)      if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE)
394        {        {
395          setBoundsForFrame((JInternalFrame) component, dragCache.x,          setBoundsForFrame((JInternalFrame) component, dragCache.x, dragCache.y,
396                            dragCache.y, dragCache.width, dragCache.height);                            dragCache.width, dragCache.height);
397          pane = null;          pane = null;
398          dragCache = null;          dragCache = null;
399        }        }
400      component.repaint();      component.repaint();
401    }    }
# Line 436  public class DefaultDesktopManager imple Line 437  public class DefaultDesktopManager imple
437    
438      if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE)      if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE)
439        {        {
440          // FIXME: Do outline drag painting.          // FIXME: Do outline drag painting.
441        }        }
442      else      else
443        setBoundsForFrame(component, dragCache.x, dragCache.y, dragCache.width,        setBoundsForFrame(component, dragCache.x, dragCache.y, dragCache.width,
# Line 454  public class DefaultDesktopManager imple Line 455  public class DefaultDesktopManager imple
455    {    {
456      if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE)      if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE)
457        {        {
458          setBoundsForFrame((JInternalFrame) component, dragCache.x,          setBoundsForFrame((JInternalFrame) component, dragCache.x, dragCache.y,
459                            dragCache.y, dragCache.width, dragCache.height);                            dragCache.width, dragCache.height);
460          pane = null;          pane = null;
461          dragCache = null;          dragCache = null;
462        }        }
463      component.repaint();      component.repaint();
464    }    }
# Line 534  public class DefaultDesktopManager imple Line 535  public class DefaultDesktopManager imple
535      iconRects = new Rectangle[count];      iconRects = new Rectangle[count];
536      for (int i = 0, j = 0; i < frames.length; i++)      for (int i = 0, j = 0; i < frames.length; i++)
537        if (frames[i] instanceof JDesktopIcon)        if (frames[i] instanceof JDesktopIcon)
538          iconRects[--count] = frames[i].getBounds();          iconRects[--count] = frames[i].getBounds();
539        else if (frames[i] instanceof JInternalFrame        else if (frames[i] instanceof JInternalFrame
540                 && ((JInternalFrame) frames[i]).getWasIcon()                 && ((JInternalFrame) frames[i]).getWasIcon()
541                 && frames[i] != frame)                 && frames[i] != frame)
542          iconRects[--count] = ((JInternalFrame) frames[i]).getDesktopIcon()          iconRects[--count] = ((JInternalFrame) frames[i])
543                                .getBounds();                                                   .getDesktopIcon().getBounds();
544    
545      int startingX = insets.left;      int startingX = insets.left;
546      int startingY = paneBounds.height - insets.bottom - pref.height;      int startingY = paneBounds.height - insets.bottom - pref.height;
# Line 549  public class DefaultDesktopManager imple Line 550  public class DefaultDesktopManager imple
550    
551      while (iconRects.length > 0)      while (iconRects.length > 0)
552        {        {
553          clear = true;          clear = true;
554          for (int i = 0; i < iconRects.length; i++)          for (int i = 0; i < iconRects.length; i++)
555            {            {
556              if (iconRects[i] != null && iconRects[i].intersects(ideal))              if (iconRects[i] != null && iconRects[i].intersects(ideal))
557                {                {
558                  clear = false;                  clear = false;
559                  break;                  break;
560                }                }
561            }            }
562          if (clear)          if (clear)
563            return ideal;            return ideal;
564    
565          startingX += pref.width;          startingX += pref.width;
566          if (startingX + pref.width > paneBounds.width - insets.right)          if (startingX + pref.width > paneBounds.width - insets.right)
567            {            {
568              startingX = insets.left;              startingX = insets.left;
569              startingY -= pref.height;              startingY -= pref.height;
570            }            }
571          ideal.setBounds(startingX, startingY, pref.width, pref.height);          ideal.setBounds(startingX, startingY, pref.width, pref.height);
572        }        }
573    
574      return ideal;      return ideal;

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

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