KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > rero > gui > sdi > ClientSingleWindow


1 package rero.gui.sdi;
2
3 import javax.swing.*;
4 import javax.swing.event.*;
5
6 import java.awt.*;
7 import java.awt.event.*;
8
9 import java.util.*;
10
11 import rero.gui.windows.*;
12
13 public class ClientSingleWindow extends JPanel implements ClientWindow
14 {
15    protected LinkedList clisteners = new LinkedList();
16    protected ClientWindowEvent cevent;
17    protected ClientPanel parent;
18
19    public ClientSingleWindow(ClientPanel _parent)
20    {
21       cevent = new ClientWindowEvent(this);
22       setLayout(new BorderLayout());
23
24       parent = _parent;
25    }
26
27    public void addWindowListener(ClientWindowListener l)
28    {
29       clisteners.add(l);
30    }
31  
32    public void processActive()
33    {
34       Iterator i = clisteners.listIterator();
35       while (i.hasNext())
36       {
37          ClientWindowListener temp = (ClientWindowListener)i.next();
38          temp.onActive(cevent);
39       }
40    }
41
42    public void processInactive()
43    {
44       Iterator i = clisteners.listIterator();
45       while (i.hasNext())
46       {
47          ClientWindowListener temp = (ClientWindowListener)i.next();
48          temp.onInactive(cevent);
49       }
50    }
51
52    public void processClose()
53    {
54       Iterator i = clisteners.listIterator();
55       while (i.hasNext())
56       {
57           ClientWindowListener temp = (ClientWindowListener)i.next();
58           temp.onClose(cevent);
59       }
60    }
61
62    public void processOpen()
63    {
64       Iterator i = clisteners.listIterator();
65       while (i.hasNext())
66       {
67           ClientWindowListener temp = (ClientWindowListener)i.next();
68           temp.onOpen(cevent);
69       }
70    }
71
72     public void closeWindow()
73     {
74        parent.killWindow(this);
75     }
76
77     public boolean isMaximum() { return false; }
78     public boolean isIcon() { return false; }
79
80     public void setMaximum(boolean b) { }
81
82     public void setIcon(boolean b)
83     {
84         if (b)
85         {
86            parent.doDeactivate(parent.getWindowFor(this));
87         }
88         else
89         {
90            parent.doActivate(parent.getWindowFor(this));
91         }
92     }
93
94     public void setIcon(ImageIcon blah) { }
95     public void show() { }
96
97     public boolean isSelected() { return parent.getActiveWindow() != null && parent.getActiveWindow().getWindow() == this; }
98
99     public void activate()
100     {
101         parent.doActivate(parent.getWindowFor(this));
102     }
103
104
105     public void setTitle(String JavaDoc title) { }
106     public String JavaDoc getTitle() { return ""; }
107
108     public void setContentPane(Container c)
109     {
110        add(c, BorderLayout.CENTER);
111     }
112 }
113
Popular Tags