01: // ========================================================================
02: // $Id: Frame.java,v 1.3 2004/05/09 20:31:28 gregwilkins Exp $
03: // Copyright 1996-2004 Mort Bay Consulting Pty. Ltd.
04: // ------------------------------------------------------------------------
05: // Licensed under the Apache License, Version 2.0 (the "License");
06: // you may not use this file except in compliance with the License.
07: // You may obtain a copy of the License at
08: // http://www.apache.org/licenses/LICENSE-2.0
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14: // ========================================================================
15:
16: package org.mortbay.html;
17:
18: import java.io.IOException;
19: import java.io.Writer;
20:
21: /** FrameSet.
22: * @version $Id: Frame.java,v 1.3 2004/05/09 20:31:28 gregwilkins Exp $
23: * @author Greg Wilkins
24: */
25: public class Frame {
26: String src = null;
27: String name = null;
28:
29: String scrolling = "auto";
30: String resize = "";
31: String border = "";
32:
33: /* ------------------------------------------------------------ */
34: /** Frame constructor.
35: */
36: Frame() {
37: }
38:
39: /* ------------------------------------------------------------ */
40: public Frame border(boolean threeD, int width, String color) {
41: border = " frameborder=\"" + (threeD ? "yes" : "no") + "\"";
42: if (width >= 0)
43: border += " border=\"" + width + "\"";
44:
45: if (color != null)
46: border += " BORDERCOLOR=\"" + color + "\"";
47: return this ;
48: }
49:
50: /* ------------------------------------------------------------ */
51: public Frame name(String name, String src) {
52: this .name = name;
53: this .src = src;
54: return this ;
55: }
56:
57: /* ------------------------------------------------------------ */
58: public Frame src(String s) {
59: src = s;
60: return this ;
61: }
62:
63: /* ------------------------------------------------------------ */
64: public Frame name(String n) {
65: name = n;
66: return this ;
67: }
68:
69: /* ------------------------------------------------------------ */
70: public Frame scrolling(boolean s) {
71: scrolling = s ? "yes" : "no";
72: return this ;
73: }
74:
75: /* ------------------------------------------------------------ */
76: public Frame resize(boolean r) {
77: resize = r ? "" : " noresize";
78: return this ;
79: }
80:
81: /* ----------------------------------------------------------------- */
82: void write(Writer out) throws IOException {
83: out.write("<frame scrolling=\"" + scrolling + "\"" + resize
84: + border);
85:
86: if (src != null)
87: out.write(" src=\"" + src + "\"");
88: if (name != null)
89: out.write(" name=\"" + name + "\"");
90: out.write(">");
91: }
92: };
|