01: /**
02: * Copyright 2006 Webmedia Group Ltd.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: **/package org.araneaframework.example.common.tags.wizard;
16:
17: import java.io.Writer;
18: import org.araneaframework.example.common.framework.context.WizardContext;
19: import org.araneaframework.jsp.tag.BaseTag;
20:
21: /**
22: * This tag displays wizard's navigation info.
23: *
24: * @author Rein Raudjärv <reinra@ut.ee>
25: *
26: * @jsp.tag
27: * name = "wizardHeader"
28: * body-content = "JSP"
29: * description = "Includes navigation info."
30: */
31: public class WizardHeaderTag extends BaseTag {
32: protected int doStartTag(Writer out) throws Exception {
33: WizardContext wizard = (WizardContext) getContextWidget();
34:
35: int index = wizard.getCurrentPageIndex();
36: int count = wizard.countPages();
37:
38: StringBuffer sb = new StringBuffer();
39: sb.append("Page ");
40: sb.append(index + 1);
41: sb.append(" of ");
42: sb.append(count);
43:
44: out.write(sb.toString());
45:
46: return SKIP_BODY;
47: }
48: }
|