1920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson/* 2920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * Copyright (C) 2010 Google Inc. 3920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * 4920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * Licensed under the Apache License, Version 2.0 (the "License"); 5920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * you may not use this file except in compliance with the License. 6920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * You may obtain a copy of the License at 7920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * 8920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * http://www.apache.org/licenses/LICENSE-2.0 9920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * 10920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * Unless required by applicable law or agreed to in writing, software 11920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * distributed under the License is distributed on an "AS IS" BASIS, 12920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * See the License for the specific language governing permissions and 14920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * limitations under the License. 15920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson */ 16920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 17920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodsonpackage com.google.doclava; 18920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 19920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodsonimport com.google.clearsilver.jsilver.data.Data; 20920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 21920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodsonpublic class SeeTagInfo extends TagInfo { 22920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson private ContainerInfo mBase; 23920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson LinkReference mLink; 24920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 25920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson SeeTagInfo(String name, String kind, String text, ContainerInfo base, SourcePositionInfo position) { 26920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson super(name, kind, text, position); 27920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson mBase = base; 28920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 29920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 30920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson protected LinkReference linkReference() { 31920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson if (mLink == null) { 32920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson mLink = 33920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson LinkReference.parse(text(), mBase, position(), (!"@see".equals(name())) 34920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson && (mBase != null ? mBase.checkLevel() : true)); 35920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 36920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson return mLink; 37920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 38920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 39920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson public String label() { 40920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson return linkReference().label; 41920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 42920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 43920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson @Override 44920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson public void makeHDF(Data data, String base) { 45920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson LinkReference linkRef = linkReference(); 46920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson if (linkRef.kind != null) { 47920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson // if they have a better suggestion about "kind" use that. 48920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson // do this before super.makeHDF() so it picks it up 49920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson setKind(linkRef.kind); 50920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 51920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 52920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson super.makeHDF(data, base); 53920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 54920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson data.setValue(base + ".label", linkRef.label); 55920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson if (linkRef.href != null) { 56920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson data.setValue(base + ".href", linkRef.href); 57920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 58920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 59920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 60920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson public boolean checkLevel() { 61920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson return linkReference().checkLevel(); 62920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 63920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 64920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson public static void makeHDF(Data data, String base, SeeTagInfo[] tags) { 65920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson int j = 0; 66920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson for (SeeTagInfo tag : tags) { 67920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson if (tag.mBase.checkLevel() && tag.checkLevel()) { 68920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson tag.makeHDF(data, base + "." + j); 69920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson j++; 70920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 71920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 72920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 73920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson} 74