- generalized simple user interface to add media (#3339)
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / element / TextWithLabelElement.java
index 878788b3150d8c646ecffa2e7c863a67ca8a81c6..4f5c86ca2cb615bbf28469438c5bc5a7fec0908b 100644 (file)
@@ -37,6 +37,10 @@ public class TextWithLabelElement extends AbstractCdmFormElement implements Modi
     /** Constant <code>SINGLE=-1</code> */
     public static final int SINGLE = -1;
 
+    protected TextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString,
+            String initialText, Integer textHeight, int style) {
+        this(formFactory, parentElement, labelString, initialText, textHeight, null, style);
+    }
     /**
      * <p>
      * Constructor for TextWithLabelElement.
@@ -54,12 +58,13 @@ public class TextWithLabelElement extends AbstractCdmFormElement implements Modi
      *            a {@link java.lang.String} object.
      * @param textHeight
      *            a {@link java.lang.Integer} object.
+     *            @param textLimit max characters allowed to enter
      * @param style
      *            a int.
      * @wbp.parser.entryPoint
      */
     protected TextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString,
-            String initialText, Integer textHeight, int style) {
+            String initialText, Integer textHeight, Integer textLimit, int style) {
         super(formFactory, parentElement);
 
         if (labelString != null) {
@@ -78,6 +83,7 @@ public class TextWithLabelElement extends AbstractCdmFormElement implements Modi
         }
 
         text = formFactory.createText(getLayoutComposite(), "", combinedStyle);
+        text.setTextLimit(textLimit!=null?textLimit:Text.LIMIT);
 
         addControl(text);
 
@@ -163,6 +169,14 @@ public class TextWithLabelElement extends AbstractCdmFormElement implements Modi
         text.setForeground(getColor(symbolicName));
     }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement#isEnabled()
+     */
+    @Override
+    public boolean isEnabled() {
+        return text.isEnabled();
+    }
+
     /** {@inheritDoc} */
     @Override
     public void setIrrelevant(boolean irrelevant) {
@@ -218,4 +232,5 @@ public class TextWithLabelElement extends AbstractCdmFormElement implements Modi
     public void setTextLimit(int limit) {
         text.setTextLimit(limit);
     }
+
 }