Revision 82dfc775
Added by Patrick Plitzner about 10 years ago
- added option to set text limit for TextWithLabelElement
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java | ||
---|---|---|
604 | 604 |
* createTextWithLabelElement |
605 | 605 |
* </p> |
606 | 606 |
* |
607 |
* @param parentElement |
|
608 |
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} |
|
609 |
* object. |
|
607 | 610 |
* @param labelString |
608 | 611 |
* a {@link java.lang.String} object. |
609 | 612 |
* @param initialText |
610 | 613 |
* a {@link java.lang.String} object. |
611 | 614 |
* @param style |
612 | 615 |
* a int. |
616 |
* @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement} |
|
617 |
* object. |
|
618 |
*/ |
|
619 |
public TextWithLabelElement createTextWithLabelElement(ICdmFormElement parentElement, String labelString, |
|
620 |
String initialText, int style) { |
|
621 |
return createTextWithLabelElement(parentElement, labelString, initialText, null, style); |
|
622 |
} |
|
623 |
/** |
|
624 |
* <p> |
|
625 |
* createTextWithLabelElement |
|
626 |
* </p> |
|
627 |
* |
|
613 | 628 |
* @param parentElement |
614 | 629 |
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} |
615 | 630 |
* object. |
631 |
* @param labelString |
|
632 |
* a {@link java.lang.String} object. |
|
633 |
* @param initialText |
|
634 |
* a {@link java.lang.String} object. |
|
635 |
* @param textLimit maximal number of characters allowed |
|
636 |
* @param style |
|
637 |
* a int. |
|
616 | 638 |
* @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement} |
617 | 639 |
* object. |
618 | 640 |
*/ |
619 | 641 |
public TextWithLabelElement createTextWithLabelElement(ICdmFormElement parentElement, String labelString, |
620 |
String initialText, int style) { |
|
642 |
String initialText, Integer textLimit, int style) {
|
|
621 | 643 |
if(initialText==null){ |
622 | 644 |
initialText = ""; |
623 | 645 |
} |
624 | 646 |
|
625 |
TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, initialText, null, |
|
626 |
style); |
|
647 |
TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, initialText, null, textLimit, style); |
|
627 | 648 |
adapt(element); |
628 | 649 |
parentElement.addElement(element); |
629 | 650 |
return element; |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java | ||
---|---|---|
37 | 37 |
/** Constant <code>SINGLE=-1</code> */ |
38 | 38 |
public static final int SINGLE = -1; |
39 | 39 |
|
40 |
protected TextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString, |
|
41 |
String initialText, Integer textHeight, int style) { |
|
42 |
this(formFactory, parentElement, labelString, initialText, textHeight, null, style); |
|
43 |
} |
|
40 | 44 |
/** |
41 | 45 |
* <p> |
42 | 46 |
* Constructor for TextWithLabelElement. |
... | ... | |
54 | 58 |
* a {@link java.lang.String} object. |
55 | 59 |
* @param textHeight |
56 | 60 |
* a {@link java.lang.Integer} object. |
61 |
* @param textLimit max characters allowed to enter |
|
57 | 62 |
* @param style |
58 | 63 |
* a int. |
59 | 64 |
* @wbp.parser.entryPoint |
60 | 65 |
*/ |
61 | 66 |
protected TextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString, |
62 |
String initialText, Integer textHeight, int style) { |
|
67 |
String initialText, Integer textHeight, Integer textLimit, int style) {
|
|
63 | 68 |
super(formFactory, parentElement); |
64 | 69 |
|
65 | 70 |
if (labelString != null) { |
... | ... | |
78 | 83 |
} |
79 | 84 |
|
80 | 85 |
text = formFactory.createText(getLayoutComposite(), "", combinedStyle); |
86 |
text.setTextLimit(textLimit!=null?textLimit:Text.LIMIT); |
|
81 | 87 |
|
82 | 88 |
addControl(text); |
83 | 89 |
|
Also available in: Unified diff