Split up control creation of TextWithLabelElement
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / element / TextWithLabelElement.java
index efe1877a287fd27098b4bd04e4941c6109c7f69e..039b54c0d7826c31c25ce617e039b2e4ae892e80 100644 (file)
@@ -60,22 +60,13 @@ public class TextWithLabelElement extends AbstractCdmFormElement implements Modi
 
         this.isMultiLine = isMultiLine;
 
-        init(formFactory, labelString, initialText, textHeight, textLimit, isMultiLine, style, getLayoutComposite());
-    }
+        initLabel(formFactory, labelString, isMultiLine, getLayoutComposite());
 
-    protected void init(CdmFormFactory formFactory, String labelString, String initialText, Integer textHeight,
-            Integer textLimit, boolean isMultiLine, int style, Composite layoutComposite) {
-        if (labelString != null) {
-            label = formFactory.createLabel(layoutComposite, CdmUtils.Nz(labelString), SWT.NULL);
-            addControl(label);
-            if(isMultiLine){
-                label.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-            }
-            else{
-                label.setLayoutData(LayoutConstants.LEFT());
-            }
-        }
+        initText(formFactory, initialText, textHeight, textLimit, isMultiLine, style, getLayoutComposite());
+    }
 
+    protected void initText(CdmFormFactory formFactory, String initialText, Integer textHeight, Integer textLimit,
+            boolean isMultiLine, int style, Composite layoutComposite) {
         int scrollStyle = textHeight == null ? SWT.NULL : (SWT.V_SCROLL | SWT.MULTI);
 
         int combinedStyle = style | SWT.BORDER | scrollStyle;
@@ -128,6 +119,19 @@ public class TextWithLabelElement extends AbstractCdmFormElement implements Modi
         setText(initialText);
     }
 
+    protected void initLabel(CdmFormFactory formFactory, String labelString, boolean isMultiLine, Composite layoutComposite) {
+        if (labelString != null) {
+            label = formFactory.createLabel(layoutComposite, CdmUtils.Nz(labelString), SWT.NULL);
+            addControl(label);
+            if(isMultiLine){
+                label.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+            }
+            else{
+                label.setLayoutData(LayoutConstants.LEFT());
+            }
+        }
+    }
+
     /**
      * Get the text of this composites text composite
      *