01: // This file is part of KeY - Integrated Deductive Software Design
02: // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
03: // Universitaet Koblenz-Landau, Germany
04: // Chalmers University of Technology, Sweden
05: //
06: // The KeY system is protected by the GNU General Public License.
07: // See LICENSE.TXT for details.
08: //This file is part of KeY - Integrated Deductive Software Design
09: //Copyright (C) 2001-2003 Universitaet Karlsruhe, Germany
10: // and Chalmers University of Technology, Sweden
11: //
12: //The KeY system is protected by the GNU General Public License.
13: //See LICENSE.TXT for details.
14: //
15:
16: package de.uka.ilkd.key.rule.export.html;
17:
18: public class HTMLFragmentLink extends HTMLLink {
19: private HTMLFile sourceFile;
20: private HTMLFragment targetFragment;
21:
22: public HTMLFragmentLink(HTMLFile sourceFile,
23: HTMLFragment targetFragment) {
24: this .sourceFile = sourceFile;
25: this .targetFragment = targetFragment;
26: }
27:
28: public String toString() {
29: return getURL();
30: }
31:
32: protected String getURL() {
33: StringBuffer rv = new StringBuffer();
34: final HTMLFile targetFile = targetFragment.getFile();
35: if (targetFile != null) {
36: if (sourceFile != targetFile) {
37: rv.append(sourceFile.getRelPath(targetFile));
38: }
39:
40: final String id = targetFragment.getId();
41: if (id != null) {
42: rv.append("#");
43: rv.append(id);
44: }
45: }
46: return rv.toString();
47: }
48:
49: /**
50: * @return Returns the sourceFile.
51: */
52: HTMLFile getSourceFile() {
53: return sourceFile;
54: }
55:
56: /**
57: * @param sourceFile The sourceFile to set.
58: */
59: void setSourceFile(HTMLFile sourceFile) {
60: this .sourceFile = sourceFile;
61: }
62:
63: /**
64: * @return Returns the targetFragment.
65: */
66: Object getTargetFragment() {
67: return targetFragment;
68: }
69:
70: /**
71: * @param targetFragment The targetFragment to set.
72: */
73: void setTargetFragment(HTMLFragment targetFragment) {
74: this.targetFragment = targetFragment;
75: }
76:
77: }
|