01: package org.osbl.client.wings.form.layouter;
02:
03: import org.wings.*;
04: import org.wings.border.*;
05: import org.osbl.client.wings.form.ComponentProvider;
06:
07: import java.awt.*;
08:
09: /**
10: * Place a title obtained from the ComponentProvider.
11: */
12: public class Title extends Line {
13: static private GridBagConstraints titleConstraints = new GridBagConstraints();
14: static private GridBagConstraints titleConstraints2 = new GridBagConstraints();
15: static {
16: titleConstraints = new GridBagConstraints();
17: titleConstraints.fill = GridBagConstraints.HORIZONTAL;
18: titleConstraints.anchor = GridBagConstraints.SOUTH;
19: titleConstraints.gridwidth = GridBagConstraints.RELATIVE;
20: titleConstraints.insets = new Insets(0, 0, 10, 0);
21: titleConstraints.weightx = 0d;
22: titleConstraints2 = new GridBagConstraints();
23: titleConstraints2.fill = GridBagConstraints.HORIZONTAL;
24: titleConstraints2.anchor = GridBagConstraints.SOUTH;
25: titleConstraints2.gridwidth = GridBagConstraints.REMAINDER;
26: titleConstraints2.insets = new Insets(0, 0, 10, 0);
27: titleConstraints2.weightx = 1d;
28: }
29:
30: static SAbstractBorder titleBorder = new SLineBorder(Color.ORANGE,
31: 0);
32: static SAbstractBorder titleBorder2 = new SLineBorder(Color.ORANGE,
33: 0);
34: static {
35: titleBorder.setThickness(4, SConstants.BOTTOM);
36: titleBorder.setInsets(new Insets(0, 0, 2, 0));
37: titleBorder2.setThickness(1, SConstants.BOTTOM);
38: titleBorder2.setInsets(new Insets(0, 0, 2, 0));
39: }
40:
41: public String titleCode;
42:
43: /**
44: * Construct a title placement description.
45: * @param titleCode obtain a title label for this code from the ComponentProvider
46: */
47: public Title(String titleCode) {
48: this .titleCode = titleCode;
49: }
50:
51: public void build(ComponentProvider componentProvider,
52: SContainer container) {
53: SLabel titleLabel = componentProvider.createTitle(titleCode);
54: titleLabel.putClientProperty("instruction", this );
55: titleLabel.setBorder((SBorder) titleBorder.clone());
56: titleLabel.setPreferredSize(SDimension.FULLWIDTH);
57: titleLabel.setStyle("SLabel formtitle");
58:
59: container.add(titleLabel, titleConstraints);
60:
61: SLabel titleLabel2 = new SLabel(" ");
62: titleLabel2.setBorder((SBorder) titleBorder2.clone());
63: titleLabel2.setPreferredSize(SDimension.FULLWIDTH);
64: titleLabel2.setStyle("SLabel formtitle");
65: container.add(titleLabel2, titleConstraints2);
66: }
67: }
|