01: /*
02: * Copyright Javelin Software, All rights reserved.
03: */
04:
05: package com.javelin.swinglets;
06:
07: import java.awt.*;
08: import java.util.*;
09: import java.io.*;
10:
11: /**
12: * SLink defines a hypelink.
13: *
14: * @author Robin Sharp
15: */
16:
17: public class SLink {
18: /**
19: * Creates a Hyperlink. If the URL is the component that this link is
20: * part of (e.g. Label or Icon) will be called back with an action event.
21: */
22: public SLink() {
23: }
24:
25: /**
26: * Creates a Hyperlink.
27: */
28: public SLink(String url) {
29: this .url = url;
30: }
31:
32: /**
33: * Creates a Hyperlink, with a target. Targets are defined in the SFrame class.
34: */
35: public SLink(String url, String target) {
36: this .url = url;
37: this .target = target;
38: }
39:
40: /**
41: * Creates a link that will open a dialog. This will call the dialog.getURL()
42: * and set the target to be NEW.
43: */
44: public SLink(SDialog dialog) {
45: this (dialog.getComponentUrl(), SDialog.NEW);
46: }
47:
48: /**
49: * Returns the name of the L&F class that renders this component.
50: */
51: public Class getUIClass() {
52: return SLink.class;
53: }
54:
55: /**
56: * Get the link's URL.<br>
57: */
58: public String getUrl() {
59: return url;
60: }
61:
62: /**
63: * Set the link's URL.
64: */
65: public SLink setUrl(String url) {
66: this .url = url;
67: return this ;
68: }
69:
70: /**
71: * Get the target frame for the link.
72: * Taken from SFrame. One of THIS, PARENT, NEW, WINDOW, <NAME>.
73: */
74: public String getTarget() {
75: return target;
76: }
77:
78: /**
79: * Set the target frame for the link.
80: */
81: public SLink setTarget(String target) {
82: this .target = target;
83: return this ;
84: }
85:
86: public String toString() {
87: return url;
88: }
89:
90: // PRIVATE ////////////////////////////////////////////////////////
91:
92: protected String url;
93: protected String target;
94:
95: }
|