01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /* $Id$ */
19:
20: package org.apache.xmlgraphics.ps.dsc.events;
21:
22: import java.io.IOException;
23:
24: import org.apache.xmlgraphics.ps.PSGenerator;
25:
26: /**
27: * Represents a line of PostScript code.
28: */
29: public class PostScriptLine extends AbstractEvent {
30:
31: private String line;
32:
33: /**
34: * Creates a new instance.
35: * @param line the code line
36: */
37: public PostScriptLine(String line) {
38: this .line = line;
39: }
40:
41: /**
42: * Returns the code line.
43: * @return the code line
44: */
45: public String getLine() {
46: return this .line;
47: }
48:
49: /**
50: * @see org.apache.xmlgraphics.ps.dsc.events.DSCEvent#generate(org.apache.xmlgraphics.ps.PSGenerator)
51: */
52: public void generate(PSGenerator gen) throws IOException {
53: gen.writeln(getLine());
54: }
55:
56: /**
57: * @see org.apache.xmlgraphics.ps.dsc.events.DSCEvent#getEventType()
58: */
59: public int getEventType() {
60: return LINE;
61: }
62:
63: /**
64: * @see org.apache.xmlgraphics.ps.dsc.events.AbstractEvent#asLine()
65: */
66: public PostScriptLine asLine() {
67: return this ;
68: }
69:
70: /**
71: * @see org.apache.xmlgraphics.ps.dsc.events.AbstractEvent#isLine()
72: */
73: public boolean isLine() {
74: return true;
75: }
76:
77: }
|