001: /*
002: * This file is part of the Echo Web Application Framework (hereinafter "Echo").
003: * Copyright (C) 2002-2005 NextApp, Inc.
004: *
005: * Version: MPL 1.1/GPL 2.0/LGPL 2.1
006: *
007: * The contents of this file are subject to the Mozilla Public License Version
008: * 1.1 (the "License"); you may not use this file except in compliance with
009: * the License. You may obtain a copy of the License at
010: * http://www.mozilla.org/MPL/
011: *
012: * Software distributed under the License is distributed on an "AS IS" basis,
013: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
014: * for the specific language governing rights and limitations under the
015: * License.
016: *
017: * Alternatively, the contents of this file may be used under the terms of
018: * either the GNU General Public License Version 2 or later (the "GPL"), or
019: * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
020: * in which case the provisions of the GPL or the LGPL are applicable instead
021: * of those above. If you wish to allow use of your version of this file only
022: * under the terms of either the GPL or the LGPL, and not to allow others to
023: * use your version of this file under the terms of the MPL, indicate your
024: * decision by deleting the provisions above and replace them with the notice
025: * and other provisions required by the GPL or the LGPL. If you do not delete
026: * the provisions above, a recipient may use your version of this file under
027: * the terms of any one of the MPL, the GPL or the LGPL.
028: */
029:
030: package nextapp.echo2.testapp.interactive.testscreen;
031:
032: import nextapp.echo2.app.Color;
033: import nextapp.echo2.app.Extent;
034: import nextapp.echo2.app.Font;
035: import nextapp.echo2.app.Insets;
036: import nextapp.echo2.app.Label;
037: import nextapp.echo2.app.SplitPane;
038: import nextapp.echo2.app.layout.SplitPaneLayoutData;
039:
040: /**
041: * An interactive test which draws a nautilus-like series of nested
042: * <code>SplitPane</code>s.
043: */
044: public class SplitPaneNestedTest extends SplitPane {
045:
046: private static final Extent EXTENT_80 = new Extent(80);
047: private static final Insets INSETS_10 = new Insets(10);
048: private static final Color COLOR_A = new Color(0xaf7f7f);
049: private static final Color COLOR_B = new Color(0xbf7f7f);
050: private static final Color COLOR_C = new Color(0xbf9f7f);
051: private static final Color COLOR_D = new Color(0xbfbf7f);
052: private static final Color COLOR_E = new Color(0x9fbf7f);
053: private static final Color COLOR_F = new Color(0x7fbf7f);
054: private static final Color COLOR_G = new Color(0x7fbf9f);
055: private static final Color COLOR_H = new Color(0x7fbfbf);
056: private static final Color COLOR_I = new Color(0x7f9fbf);
057: private static final Font BIG_FONT = new Font(Font.COURIER_NEW,
058: Font.BOLD, new Extent(30));
059:
060: public SplitPaneNestedTest() {
061: this (EXTENT_80);
062: }
063:
064: public SplitPaneNestedTest(Extent paneSize) {
065: super (SplitPane.ORIENTATION_VERTICAL, paneSize);
066: setStyleName("DefaultResizable");
067: setFont(BIG_FONT);
068:
069: Label label;
070: SplitPaneLayoutData splitPaneLayoutData;
071:
072: splitPaneLayoutData = new SplitPaneLayoutData();
073: splitPaneLayoutData.setBackground(COLOR_A);
074: splitPaneLayoutData.setInsets(INSETS_10);
075: label = new Label("A");
076: label.setLayoutData(splitPaneLayoutData);
077: add(label);
078: SplitPane splitPaneAlpha = new SplitPane(
079: SplitPane.ORIENTATION_HORIZONTAL_LEADING_TRAILING,
080: paneSize);
081: splitPaneAlpha.setStyleName("DefaultResizable");
082: add(splitPaneAlpha);
083:
084: splitPaneLayoutData = new SplitPaneLayoutData();
085: splitPaneLayoutData.setBackground(COLOR_B);
086: splitPaneLayoutData.setInsets(INSETS_10);
087: label = new Label("B");
088: label.setLayoutData(splitPaneLayoutData);
089: splitPaneAlpha.add(label);
090: SplitPane splitPaneBravo = new SplitPane(
091: SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, paneSize);
092: splitPaneBravo.setStyleName("DefaultResizable");
093: splitPaneAlpha.add(splitPaneBravo);
094:
095: splitPaneLayoutData = new SplitPaneLayoutData();
096: splitPaneLayoutData.setBackground(COLOR_C);
097: splitPaneLayoutData.setInsets(INSETS_10);
098: label = new Label("C");
099: label.setLayoutData(splitPaneLayoutData);
100: splitPaneBravo.add(label);
101: SplitPane splitPaneCharlie = new SplitPane(
102: SplitPane.ORIENTATION_HORIZONTAL_TRAILING_LEADING,
103: paneSize);
104: splitPaneCharlie.setStyleName("DefaultResizable");
105: splitPaneBravo.add(splitPaneCharlie);
106:
107: splitPaneLayoutData = new SplitPaneLayoutData();
108: splitPaneLayoutData.setBackground(COLOR_D);
109: splitPaneLayoutData.setInsets(INSETS_10);
110: label = new Label("D");
111: label.setLayoutData(splitPaneLayoutData);
112: splitPaneCharlie.add(label);
113: SplitPane splitPaneDelta = new SplitPane(
114: SplitPane.ORIENTATION_VERTICAL_TOP_BOTTOM, paneSize);
115: splitPaneDelta.setStyleName("DefaultResizable");
116: splitPaneCharlie.add(splitPaneDelta);
117:
118: splitPaneLayoutData = new SplitPaneLayoutData();
119: splitPaneLayoutData.setBackground(COLOR_E);
120: splitPaneLayoutData.setInsets(INSETS_10);
121: label = new Label("E");
122: label.setLayoutData(splitPaneLayoutData);
123: splitPaneDelta.add(label);
124: SplitPane splitPaneEcho = new SplitPane(
125: SplitPane.ORIENTATION_HORIZONTAL_LEADING_TRAILING,
126: paneSize);
127: splitPaneEcho.setStyleName("DefaultResizable");
128: splitPaneDelta.add(splitPaneEcho);
129:
130: splitPaneLayoutData = new SplitPaneLayoutData();
131: splitPaneLayoutData.setBackground(COLOR_F);
132: splitPaneLayoutData.setInsets(INSETS_10);
133: label = new Label("F");
134: label.setLayoutData(splitPaneLayoutData);
135: splitPaneEcho.add(label);
136: SplitPane splitPaneFoxtrot = new SplitPane(
137: SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, paneSize);
138: splitPaneFoxtrot.setStyleName("DefaultResizable");
139: splitPaneEcho.add(splitPaneFoxtrot);
140:
141: splitPaneLayoutData = new SplitPaneLayoutData();
142: splitPaneLayoutData.setBackground(COLOR_G);
143: splitPaneLayoutData.setInsets(INSETS_10);
144: label = new Label("G");
145: label.setLayoutData(splitPaneLayoutData);
146: splitPaneFoxtrot.add(label);
147: SplitPane splitPaneGolf = new SplitPane(
148: SplitPane.ORIENTATION_HORIZONTAL_TRAILING_LEADING,
149: paneSize);
150: splitPaneGolf.setStyleName("DefaultResizable");
151: splitPaneFoxtrot.add(splitPaneGolf);
152:
153: splitPaneLayoutData = new SplitPaneLayoutData();
154: splitPaneLayoutData.setBackground(COLOR_H);
155: splitPaneLayoutData.setInsets(INSETS_10);
156: label = new Label("H");
157: label.setLayoutData(splitPaneLayoutData);
158: splitPaneGolf.add(label);
159: splitPaneLayoutData = new SplitPaneLayoutData();
160: splitPaneLayoutData.setBackground(COLOR_I);
161: splitPaneLayoutData.setInsets(INSETS_10);
162: label = new Label("I");
163: label.setLayoutData(splitPaneLayoutData);
164: splitPaneGolf.add(label);
165: }
166: }
|