*** empty log message ***
[thera-pi.git] / Reha / src / rehaInternalFrame / OOOInternalFrame.java
blob3efaf46ba8a55f9c401dd4784cd15dcaa2070ff4
1 package rehaInternalFrame;
2 import java.awt.Component;
3 import java.beans.PropertyChangeEvent;
4 import java.beans.PropertyChangeListener;
5 import java.beans.PropertyVetoException;
6 import java.util.ArrayList;
7 import java.util.Iterator;
8 import java.util.List;
10 import javax.swing.JDesktopPane;
11 import javax.swing.JInternalFrame;
14 * DISABLES THE MOVE METHODS, and iconifieys other OOOInternalFrames if maximized
16 public class OOOInternalFrame extends JInternalFrame {
18 /**
21 private static final long serialVersionUID = -142374973576893910L;
22 List<OOOInternalFrame> iconifiedOthers = new ArrayList<OOOInternalFrame>();
24 public OOOInternalFrame() {
25 super();
26 init();
29 public OOOInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable,
30 boolean iconifiable) {
31 super(title, resizable, closable, maximizable, iconifiable);
32 init();
35 public OOOInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable) {
36 super(title, resizable, closable, maximizable);
37 init();
40 public OOOInternalFrame(String title, boolean resizable, boolean closable) {
41 super(title, resizable, closable);
42 init();
45 public OOOInternalFrame(String title, boolean resizable) {
46 super(title, resizable);
47 init();
50 public OOOInternalFrame(String title) {
51 super(title);
52 init();
55 public void init() {
56 addPropertyChangeListener(new PropertyChangeListener() {
57 public void propertyChange(PropertyChangeEvent evt) {
58 if (evt.getPropertyName().equals(IS_MAXIMUM_PROPERTY)) {
59 boolean newValue = ((Boolean) evt.getNewValue()).booleanValue();
60 if (newValue) {
61 JDesktopPane desktop = getDesktopPane();
62 Component[] children = desktop.getComponents();
63 for (int i = 0; i < children.length; i++) {
64 Component child = children[i];
65 if (child != OOOInternalFrame.this && child instanceof OOOInternalFrame) {
66 OOOInternalFrame oooInternalFrame = (OOOInternalFrame) child;
67 if (!oooInternalFrame.isIcon()) {
68 try {
69 oooInternalFrame.setIcon(true);
70 iconifiedOthers.add(oooInternalFrame);
72 catch (PropertyVetoException e) {
73 //ignore for now
79 else if (iconifiedOthers.size() > 0) {
80 for (Iterator<OOOInternalFrame> iterator = iconifiedOthers.iterator(); iterator.hasNext();) {
81 OOOInternalFrame oooInternalFrame = iterator.next();
82 try {
83 oooInternalFrame.setIcon(false);
85 catch (PropertyVetoException e) {
86 //ignore for now
89 iconifiedOthers.clear();
93 });
96 public void moveToBack() {
97 //do nothing as this breaks the ooo window
100 public void moveToFront() {
101 //do nothing as this breaks the ooo window