]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | |
2 | import java.awt.*; | |
3 | import java.awt.event.*; | |
4 | import javax.swing.*; | |
5 | import javax.swing.event.*; | |
6 | import java.net.URL; | |
7 | import java.net.*; | |
8 | import java.io.*; | |
9 | import com.easysw.cups.*; | |
10 | ||
11 | public class GLPtabs extends JPanel | |
12 | { | |
13 | JTabbedPane tabPanel = null; | |
14 | ||
15 | // | |
16 | // Panels for the various tabs. | |
17 | // | |
18 | JPanel serverPanel = null; | |
19 | JScrollPane printersPanel = null; | |
20 | JPanel detailPanel = null; | |
21 | JPanel optionsPanel = null; | |
22 | ||
23 | GLPserver server = null; | |
24 | GLPprinters printers = null; | |
25 | GLPdetail detail = null; | |
26 | GLPoptions options = null; | |
27 | ||
28 | ||
29 | ||
30 | // Constructor | |
31 | public GLPtabs() | |
32 | { | |
33 | tabPanel = new JTabbedPane(); | |
34 | tabPanel.setBackground(Color.white); | |
35 | ||
36 | serverPanel = new JPanel(); | |
37 | server = new GLPserver(); | |
38 | serverPanel = server.getPanel(); | |
39 | tabPanel.add("Server", serverPanel); | |
40 | tabPanel.setBackgroundAt(0,GLPcolors.tabBackgroundColor); | |
41 | tabPanel.setForegroundAt(0,GLPcolors.tabForegroundColor); | |
42 | ||
43 | printersPanel = new JScrollPane(); | |
44 | printers = new GLPprinters(); | |
45 | printersPanel = printers.getPanel(); | |
46 | tabPanel.add( "Printers", printersPanel ); | |
47 | tabPanel.setBackgroundAt(1,GLPcolors.tabBackgroundColor); | |
48 | tabPanel.setForegroundAt(1,GLPcolors.tabForegroundColor); | |
49 | ||
50 | ||
51 | detail = new GLPdetail(); | |
52 | detailPanel = detail.getPanel(); | |
53 | tabPanel.add( "Destination", detailPanel ); | |
54 | tabPanel.setBackgroundAt(2,GLPcolors.tabBackgroundColor); | |
55 | tabPanel.setForegroundAt(2,GLPcolors.tabForegroundColor); | |
56 | ||
57 | options = new GLPoptions(); | |
58 | optionsPanel = new JPanel(); | |
59 | optionsPanel.setBackground(GLPcolors.backgroundColor); | |
60 | tabPanel.add( "Options", optionsPanel ); | |
61 | tabPanel.setBackgroundAt(3,GLPcolors.tabBackgroundColor); | |
62 | tabPanel.setForegroundAt(3,GLPcolors.tabForegroundColor); | |
63 | ||
64 | tabPanel.setSelectedIndex(0); | |
65 | ||
66 | tabPanel.addChangeListener(new ChangeListener() | |
67 | { | |
68 | public void stateChanged( ChangeEvent e ) | |
69 | { | |
70 | Object source = e.getSource(); | |
71 | if (!printers.cupsServerName.equals(GLPvars.getServerName())) | |
72 | { | |
73 | printers.load(); | |
74 | printersPanel = printers.getPanel(); | |
75 | tabPanel.setComponentAt(1,printersPanel); | |
76 | } | |
77 | } | |
78 | }); | |
79 | ||
80 | JPanel jobsPanel = new JPanel(); | |
81 | JPanel filePanel = new JPanel(); | |
82 | } | |
83 | ||
84 | ||
85 | ||
86 | public void updateServerPanel(String s) | |
87 | { | |
88 | server.updateServer(s); | |
89 | serverPanel = server.getPanel(); | |
90 | tabPanel.setComponentAt(0,serverPanel); | |
91 | } | |
92 | ||
93 | public void updateDetailPanel() | |
94 | { | |
95 | detail.topDetail(); | |
96 | detailPanel = detail.getPanel(); | |
97 | tabPanel.setComponentAt(2,detailPanel); | |
98 | } | |
99 | ||
100 | public void updateOptionsPanel(CupsPrinter cp) | |
101 | { | |
102 | options.updateOptions(cp); | |
103 | optionsPanel = options.getPanel(); | |
104 | tabPanel.setComponentAt(3,optionsPanel); | |
105 | } | |
106 | ||
107 | public boolean updatePrintersTab() | |
108 | { | |
109 | return(true); | |
110 | } | |
111 | ||
112 | public JTabbedPane getPanel() | |
113 | { | |
114 | return(tabPanel); | |
115 | } | |
116 | ||
117 | } |