01: /*
02: * Copyright Javelin Software, All rights reserved.
03: */
04:
05: package com.javelin.swinglets.plaf.html;
06:
07: import java.awt.*;
08: import java.util.*;
09:
10: import com.javelin.swinglets.*;
11: import com.javelin.swinglets.tabbed.*;
12:
13: /**
14: * This interface defines the methods any object that would like to be
15: * a renderer for cell in a STabbbedPane for HTML.
16: * <P>
17: * This uses crude caching of tabbed pane links, so it may need to be refreshed
18: * if the tabbed pane moves in the component hierarchy.
19: *
20: * @author Robin Sharp
21: */
22:
23: public class HTMLDefaultTabbedCellRenderer extends SLabel implements
24: STabbedCellRenderer {
25:
26: /**
27: * Create a HTMLDefaultTabbedCellRenderer.
28: */
29: public HTMLDefaultTabbedCellRenderer() {
30: }
31:
32: /**
33: * If the component is a SComponent it is returned. Otherwise the
34: * value is converted toString() on a SPanel.
35: */
36: public SComponent getTabbedCellRendererComponent(
37: STabbedPane tabbedPane, int index, SLink link) {
38: //Set other properties
39: setFont(tabbedPane.getFont());
40: setIcon(tabbedPane.getIconAt(index));
41: setText(tabbedPane.getTitleAt(index));
42: setEnabled(tabbedPane.isEnabledAt(index));
43: setLink(link);
44:
45: return this;
46: }
47:
48: }
|