KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > nextapp > echo2 > testapp > interactive > testscreen > SplitPaneNestedTest


1 /*
2  * This file is part of the Echo Web Application Framework (hereinafter "Echo").
3  * Copyright (C) 2002-2005 NextApp, Inc.
4  *
5  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * Alternatively, the contents of this file may be used under the terms of
18  * either the GNU General Public License Version 2 or later (the "GPL"), or
19  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
20  * in which case the provisions of the GPL or the LGPL are applicable instead
21  * of those above. If you wish to allow use of your version of this file only
22  * under the terms of either the GPL or the LGPL, and not to allow others to
23  * use your version of this file under the terms of the MPL, indicate your
24  * decision by deleting the provisions above and replace them with the notice
25  * and other provisions required by the GPL or the LGPL. If you do not delete
26  * the provisions above, a recipient may use your version of this file under
27  * the terms of any one of the MPL, the GPL or the LGPL.
28  */

29
30 package nextapp.echo2.testapp.interactive.testscreen;
31
32 import nextapp.echo2.app.Color;
33 import nextapp.echo2.app.Extent;
34 import nextapp.echo2.app.Font;
35 import nextapp.echo2.app.Insets;
36 import nextapp.echo2.app.Label;
37 import nextapp.echo2.app.SplitPane;
38 import nextapp.echo2.app.layout.SplitPaneLayoutData;
39
40 /**
41  * An interactive test which draws a nautilus-like series of nested
42  * <code>SplitPane</code>s.
43  */

44 public class SplitPaneNestedTest extends SplitPane {
45     
46     private static final Extent EXTENT_80 = new Extent(80);
47     private static final Insets INSETS_10 = new Insets(10);
48     private static final Color COLOR_A = new Color(0xaf7f7f);
49     private static final Color COLOR_B = new Color(0xbf7f7f);
50     private static final Color COLOR_C = new Color(0xbf9f7f);
51     private static final Color COLOR_D = new Color(0xbfbf7f);
52     private static final Color COLOR_E = new Color(0x9fbf7f);
53     private static final Color COLOR_F = new Color(0x7fbf7f);
54     private static final Color COLOR_G = new Color(0x7fbf9f);
55     private static final Color COLOR_H = new Color(0x7fbfbf);
56     private static final Color COLOR_I = new Color(0x7f9fbf);
57     private static final Font BIG_FONT = new Font(Font.COURIER_NEW, Font.BOLD, new Extent(30));
58
59     public SplitPaneNestedTest() {
60         this(EXTENT_80);
61     }
62     
63     public SplitPaneNestedTest(Extent paneSize) {
64         super(SplitPane.ORIENTATION_VERTICAL, paneSize);
65         setStyleName("DefaultResizable");
66         setFont(BIG_FONT);
67         
68         Label label;
69         SplitPaneLayoutData splitPaneLayoutData;
70         
71         splitPaneLayoutData = new SplitPaneLayoutData();
72         splitPaneLayoutData.setBackground(COLOR_A);
73         splitPaneLayoutData.setInsets(INSETS_10);
74         label = new Label("A");
75         label.setLayoutData(splitPaneLayoutData);
76         add(label);
77         SplitPane splitPaneAlpha = new SplitPane(SplitPane.ORIENTATION_HORIZONTAL_LEADING_TRAILING, paneSize);
78         splitPaneAlpha.setStyleName("DefaultResizable");
79         add(splitPaneAlpha);
80         
81         splitPaneLayoutData = new SplitPaneLayoutData();
82         splitPaneLayoutData.setBackground(COLOR_B);
83         splitPaneLayoutData.setInsets(INSETS_10);
84         label = new Label("B");
85         label.setLayoutData(splitPaneLayoutData);
86         splitPaneAlpha.add(label);
87         SplitPane splitPaneBravo = new SplitPane(SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, paneSize);
88         splitPaneBravo.setStyleName("DefaultResizable");
89         splitPaneAlpha.add(splitPaneBravo);
90         
91         splitPaneLayoutData = new SplitPaneLayoutData();
92         splitPaneLayoutData.setBackground(COLOR_C);
93         splitPaneLayoutData.setInsets(INSETS_10);
94         label = new Label("C");
95         label.setLayoutData(splitPaneLayoutData);
96         splitPaneBravo.add(label);
97         SplitPane splitPaneCharlie = new SplitPane(SplitPane.ORIENTATION_HORIZONTAL_TRAILING_LEADING, paneSize);
98         splitPaneCharlie.setStyleName("DefaultResizable");
99         splitPaneBravo.add(splitPaneCharlie);
100         
101         splitPaneLayoutData = new SplitPaneLayoutData();
102         splitPaneLayoutData.setBackground(COLOR_D);
103         splitPaneLayoutData.setInsets(INSETS_10);
104         label = new Label("D");
105         label.setLayoutData(splitPaneLayoutData);
106         splitPaneCharlie.add(label);
107         SplitPane splitPaneDelta = new SplitPane(SplitPane.ORIENTATION_VERTICAL_TOP_BOTTOM, paneSize);
108         splitPaneDelta.setStyleName("DefaultResizable");
109         splitPaneCharlie.add(splitPaneDelta);
110         
111         splitPaneLayoutData = new SplitPaneLayoutData();
112         splitPaneLayoutData.setBackground(COLOR_E);
113         splitPaneLayoutData.setInsets(INSETS_10);
114         label = new Label("E");
115         label.setLayoutData(splitPaneLayoutData);
116         splitPaneDelta.add(label);
117         SplitPane splitPaneEcho = new SplitPane(SplitPane.ORIENTATION_HORIZONTAL_LEADING_TRAILING, paneSize);
118         splitPaneEcho.setStyleName("DefaultResizable");
119         splitPaneDelta.add(splitPaneEcho);
120
121         splitPaneLayoutData = new SplitPaneLayoutData();
122         splitPaneLayoutData.setBackground(COLOR_F);
123         splitPaneLayoutData.setInsets(INSETS_10);
124         label = new Label("F");
125         label.setLayoutData(splitPaneLayoutData);
126         splitPaneEcho.add(label);
127         SplitPane splitPaneFoxtrot = new SplitPane(SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, paneSize);
128         splitPaneFoxtrot.setStyleName("DefaultResizable");
129         splitPaneEcho.add(splitPaneFoxtrot);
130
131         splitPaneLayoutData = new SplitPaneLayoutData();
132         splitPaneLayoutData.setBackground(COLOR_G);
133         splitPaneLayoutData.setInsets(INSETS_10);
134         label = new Label("G");
135         label.setLayoutData(splitPaneLayoutData);
136         splitPaneFoxtrot.add(label);
137         SplitPane splitPaneGolf = new SplitPane(SplitPane.ORIENTATION_HORIZONTAL_TRAILING_LEADING, paneSize);
138         splitPaneGolf.setStyleName("DefaultResizable");
139         splitPaneFoxtrot.add(splitPaneGolf);
140
141         splitPaneLayoutData = new SplitPaneLayoutData();
142         splitPaneLayoutData.setBackground(COLOR_H);
143         splitPaneLayoutData.setInsets(INSETS_10);
144         label = new Label("H");
145         label.setLayoutData(splitPaneLayoutData);
146         splitPaneGolf.add(label);
147         splitPaneLayoutData = new SplitPaneLayoutData();
148         splitPaneLayoutData.setBackground(COLOR_I);
149         splitPaneLayoutData.setInsets(INSETS_10);
150         label = new Label("I");
151         label.setLayoutData(splitPaneLayoutData);
152         splitPaneGolf.add(label);
153     }
154 }
155
Popular Tags