KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > structure > LinkNode


1 /*
2  * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/structure/LinkNode.java,v 1.8 2004/07/28 09:34:35 ib Exp $
3  * $Revision: 1.8 $
4  * $Date: 2004/07/28 09:34:35 $
5  *
6  * ====================================================================
7  *
8  * Copyright 1999-2002 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */

23
24 package org.apache.slide.structure;
25
26 import java.util.Vector JavaDoc;
27
28 import org.apache.slide.common.ObjectValidationFailedException;
29 import org.apache.slide.util.Messages;
30
31 /**
32  * Link node class.
33  *
34  * @version $Revision: 1.8 $
35  */

36 public class LinkNode extends ObjectNode {
37     
38     
39     // ----------------------------------------------------------- Constructors
40

41     
42     /**
43      * Constructor.
44      */

45     public LinkNode() {
46         super();
47     }
48     
49     
50     /**
51      * Default constructor.
52      */

53     public LinkNode(String JavaDoc uri) {
54         super(uri);
55     }
56     
57     
58     /**
59      * Default constructor.
60      */

61     public LinkNode(String JavaDoc uri, Vector JavaDoc children, Vector JavaDoc links) {
62         super(uri, children, links);
63     }
64     
65     
66     /**
67      * Default constructor.
68      */

69     public LinkNode(String JavaDoc uri, Vector JavaDoc children, Vector JavaDoc links,
70                     String JavaDoc linkedUri) {
71         super(uri, children, links);
72         setLinkedUri(linkedUri);
73     }
74     
75     
76     // ----------------------------------------------------- Instance Variables
77

78     
79     /**
80      * Linked Uri
81      */

82     protected String JavaDoc linkedUri;
83     
84     
85     // ------------------------------------------------------------- Properties
86

87     
88     /**
89      * Get linked Uri.
90      *
91      * @return String Linked Uri
92      */

93     public String JavaDoc getLinkedUri() {
94         return linkedUri;
95     }
96     
97     
98     /**
99      * Set linked Uri.
100      *
101      * @param linkedUri New linked Uri
102      */

103     void setLinkedUri(String JavaDoc linkedUri) {
104         if (!linkedUri.equals(getUri())) {
105             this.linkedUri = linkedUri;
106         }
107     }
108     
109     
110     /**
111      * Validate an ObjectNode.
112      *
113      * @param expectedUri Uri
114      */

115     public void validate(String JavaDoc expectedUri) {
116         super.validate(expectedUri);
117         
118         if (linkedUri == null)
119             throw new ObjectValidationFailedException
120                 (uri, Messages.message
121                  (LinkNode.class.getName() + ".nullLink"));
122         
123     }
124     
125     
126 }
127
Popular Tags