Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/Java/KeyHole/src/org/litesoft/aokeyhole/swing/namevaluecomponents/LabeledComponent.java

Diff revisions: vs.
  @@ -1,54 +1,54 @@
1 - // This Source Code is in the Public Domain per: http://unlicense.org
2 - package org.litesoft.aokeyhole.swing.namevaluecomponents;
3 -
4 - import org.litesoft.aokeyhole.swing.simplecomponents.*;
5 - import org.litesoft.aokeyhole.toolkit.*;
6 -
7 - import javax.swing.*;
8 - import java.awt.*;
9 -
10 - public abstract class LabeledComponent
11 - extends JPanelPlus
12 - implements VerticalGrowableIndicatingComponent {
13 - protected String mLabelText;
14 - private boolean mShouldUiIndicateRequired;
15 - protected JLabel mLabel = null;
16 -
17 - protected LabeledComponent( LabeledComponentParams pParams ) {
18 - mLabelText = pParams.getLabel();
19 - mShouldUiIndicateRequired = pParams.shouldUiIndicateRequired();
20 - }
21 -
22 - public LabeledComponent initialize() {
23 - buildPanel();
24 -
25 - return this;
26 - }
27 -
28 - @Override
29 - public boolean growsVertically() {
30 - return false;
31 - }
32 -
33 - protected void buildPanel() {
34 - setLayout( new BorderLayout() );
35 -
36 - add( createNorthContent(), BorderLayout.NORTH );
37 - add( new JLabel( " " ), BorderLayout.WEST );
38 - add( createCenterContent(), BorderLayout.CENTER );
39 - }
40 -
41 - protected JComponent createNorthContent() {
42 - return createLabel();
43 - }
44 -
45 - protected JComponent createLabel() {
46 - String label = mLabelText + ":";
47 - if ( mShouldUiIndicateRequired ) {
48 - label += " *";
49 - }
50 - return mLabel = new JLabel( label );
51 - }
52 -
53 - abstract protected JComponent createCenterContent();
54 - }
1 + // This Source Code is in the Public Domain per: http://unlicense.org
2 + package org.litesoft.aokeyhole.swing.namevaluecomponents;
3 +
4 + import org.litesoft.aokeyhole.swing.simplecomponents.*;
5 + import org.litesoft.aokeyhole.toolkit.*;
6 +
7 + import javax.swing.*;
8 + import java.awt.*;
9 +
10 + public abstract class LabeledComponent
11 + extends JPanelPlus
12 + implements VerticalGrowableIndicatingComponent {
13 + protected String mLabelText;
14 + private boolean mShouldUiIndicateRequired;
15 + protected JLabel mLabel = null;
16 +
17 + protected LabeledComponent( LabeledComponentParams pParams ) {
18 + mLabelText = pParams.getLabel();
19 + mShouldUiIndicateRequired = pParams.shouldUiIndicateRequired();
20 + }
21 +
22 + public LabeledComponent initialize() {
23 + buildPanel();
24 +
25 + return this;
26 + }
27 +
28 + @Override
29 + public boolean growsVertically() {
30 + return false;
31 + }
32 +
33 + protected void buildPanel() {
34 + setLayout( new BorderLayout() );
35 +
36 + add( createNorthContent(), BorderLayout.NORTH );
37 + add( new JLabel( " " ), BorderLayout.WEST );
38 + add( createCenterContent(), BorderLayout.CENTER );
39 + }
40 +
41 + protected JComponent createNorthContent() {
42 + return createLabel();
43 + }
44 +
45 + protected JComponent createLabel() {
46 + String label = mLabelText + ":";
47 + if ( mShouldUiIndicateRequired ) {
48 + label += " *";
49 + }
50 + return mLabel = new JLabel( label );
51 + }
52 +
53 + abstract protected JComponent createCenterContent();
54 + }