KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mortbay > html > Frame


1 // ========================================================================
2
// $Id: Frame.java,v 1.3 2004/05/09 20:31:28 gregwilkins Exp $
3
// Copyright 1996-2004 Mort Bay Consulting Pty. Ltd.
4
// ------------------------------------------------------------------------
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
// http://www.apache.org/licenses/LICENSE-2.0
9
// 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 import java.io.IOException JavaDoc;
18 import java.io.Writer JavaDoc;
19
20 /** FrameSet.
21  * @version $Id: Frame.java,v 1.3 2004/05/09 20:31:28 gregwilkins Exp $
22  * @author Greg Wilkins
23 */

24 public class Frame
25 {
26     String JavaDoc SRC=null;
27     String JavaDoc name=null;
28     
29     String JavaDoc scrolling="auto";
30     String JavaDoc resize="";
31     String JavaDoc border="";
32     
33     /* ------------------------------------------------------------ */
34     /** Frame constructor.
35      */

36     Frame(){}
37     
38     /* ------------------------------------------------------------ */
39     public Frame border(boolean threeD, int width, String JavaDoc color)
40     {
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     public Frame name(String JavaDoc name,String JavaDoc src)
51     {
52         this.name=name;
53         this.src=src;
54         return this;
55     }
56     
57     /* ------------------------------------------------------------ */
58     public Frame src(String JavaDoc s)
59     {
60         src=s;
61         return this;
62     }
63     
64     /* ------------------------------------------------------------ */
65     public Frame name(String JavaDoc n)
66     {
67         name=n;
68         return this;
69     }
70
71     /* ------------------------------------------------------------ */
72     public Frame scrolling(boolean s)
73     {
74         scrolling=s?"yes":"no";
75         return this;
76     }
77     
78     /* ------------------------------------------------------------ */
79     public Frame resize(boolean r)
80     {
81         resize=r?"":" noresize";
82         return this;
83     }
84     
85     /* ----------------------------------------------------------------- */
86     void write(Writer JavaDoc out)
87          throws IOException JavaDoc
88     {
89         out.write("<frame scrolling=\""+scrolling+"\""+resize+border);
90         
91         if(src!=null)
92             out.write(" SRC=\""+src+"\"");
93         if(name!=null)
94             out.write(" name=\""+name+"\"");
95         out.write(">");
96     }
97 };
98
99
100
101
102
103
104
Popular Tags