return this.createLabel(parent, null);
}
- /**
- * <p>
- * createMultilineTextWithLabel
- * </p>
- *
- * @param labelString
- * a {@link java.lang.String} object.
- * @param textHeight
- * a int.
- * @param style
- * a int.
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
- * object.
- */
- public TextWithLabelElement createMultilineTextWithLabel(ICdmFormElement parentElement, String labelString,
- int textHeight, int style) {
- TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, "", textHeight, style);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
-
/**
* <p>
* createMultiLanguageTextElement
initialText = "";
}
- TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, initialText, null, textLimit, style);
+ TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, initialText, null,
+ textLimit, style);
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
+
+ public TextWithLabelElement createMultiLineTextWithLabel(ICdmFormElement parentElement, String labelString,
+ int textHeight, int style) {
+ TextWithLabelElement element = new TextWithLabelElement(this, parentElement, labelString, "", textHeight, true, style);
adapt(element);
parentElement.addElement(element);
return element;
protected Text text;
private Label label;
+ private final boolean isMultiLine;
+
/** Constant <code>MAX_HEIGHT=0</code> */
public static final int MAX_HEIGHT = 0;
/** Constant <code>SINGLE=-1</code> */
protected TextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString,
String initialText, Integer textHeight, int style) {
- this(formFactory, parentElement, labelString, initialText, textHeight, null, style);
+ this(formFactory, parentElement, labelString, initialText, textHeight, null, false, style);
+ }
+
+ protected TextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString,
+ String initialText, Integer textHeight, boolean isMultiLine, int style) {
+ this(formFactory, parentElement, labelString, initialText, textHeight, null, isMultiLine, style);
+ }
+
+ protected TextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString,
+ String initialText, Integer textHeight, Integer textLimit, int style) {
+ this(formFactory, parentElement, labelString, initialText, textHeight, textLimit, false, style);
}
+
/**
* <p>
* Constructor for TextWithLabelElement.
* @wbp.parser.entryPoint
*/
protected TextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString,
- String initialText, Integer textHeight, Integer textLimit, int style) {
+ String initialText, Integer textHeight, Integer textLimit, boolean isMultiLine, int style) {
super(formFactory, parentElement);
+ this.isMultiLine = isMultiLine;
+
if (labelString != null) {
label = formFactory.createLabel(getLayoutComposite(), CdmUtils.Nz(labelString), SWT.NULL);
addControl(label);
- label.setLayoutData(LayoutConstants.LEFT());
+ if(isMultiLine){
+ label.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ }
+ else{
+ label.setLayoutData(LayoutConstants.LEFT());
+ }
}
int scrollStyle = textHeight == null ? SWT.NULL : (SWT.V_SCROLL | SWT.MULTI);
});
}
- TableWrapData layoutData = LayoutConstants.FILL();
+ TableWrapData layoutData;
+ if(isMultiLine){
+ layoutData = LayoutConstants.FILL_HORIZONTALLY(2, 1);
+ }
+ else{
+ layoutData = LayoutConstants.FILL();
+ }
if (textHeight != null && textHeight > 0) {
(layoutData).heightHint = textHeight;
}
/** {@inheritDoc} */
@Override
public void modifyText(ModifyEvent e) {
- if(e.widget == text){
+ if(e.widget==text && !isMultiLine){
Text text = (Text) e.widget;
boolean hasControlCharacters = false;
String textString = text.getText();
}
if(hasControlCharacters){
//remove control character such as line breaks etc.
- setText(text.getText().replaceAll("\\p{C}", ""));
+ setText(text.getText().replaceAll("\\p{C}", new Character((char)9608).toString()));
}
}
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
/** {@inheritDoc} */
@Override
protected void createControls(ICdmFormElement formElement, DescriptionBase entity, int style) {
- detailDescription = formFactory.createMultilineTextWithLabel(this, "Label", 50, SWT.WRAP);
+ detailDescription = formFactory.createMultiLineTextWithLabel(this, "Label", 50, SWT.WRAP);
detailDescription.setText(entity.getTitleCache());
// TODO I initially thought that we can handle the entity's descriptive system with a feature tree
CdmBase.deproxy(entity.getAssociatedSpecimenOrObservation(),DerivedUnit.class),
EntitySelectionElement.ALL, style);
- text_description = formFactory.createMultilineTextWithLabel(
- formElement, "Description", 200, style);
+ text_description = formFactory.createMultiLineTextWithLabel(
+ formElement, "Description for taxon - individual association", 200, style);
Map<Language, LanguageString> descriptions = entity.getDescription();
if (descriptions.get(CdmStore.getDefaultLanguage()) != null) {
entity.getTaxon2(), EntitySelectionElement.NOTHING,
SWT.WRAP);
- interactionDescription = formFactory.createMultilineTextWithLabel(this,
- "Description", 200, SWT.WRAP);
+ interactionDescription = formFactory.createMultiLineTextWithLabel(this,
+ "Description for the taxon - taxon interaction", 200, SWT.WRAP);
interactionDescription.setText(entity.getDescription(CdmStore
.getDefaultLanguage()));
}
text_uri = formFactory.createUriWithLabelElement(element, "URI",
reference.getUri(), style);
// abstract
- text_referenceAbstract = formFactory.createMultilineTextWithLabel(
+ text_referenceAbstract = formFactory.createMultiLineTextWithLabel(
element, "Reference Abstract", 100, style);
text_referenceAbstract.setText(reference.getReferenceAbstract());
}
public void createControls(ICdmFormElement element, int style) {
combo_annotationType = formFactory.createDefinedTermComboElement(TermType.AnnotationType, this, "Annotation Type", null, style);
- text = formFactory.createMultilineTextWithLabel(this, "Annotation", 100, style);
+ text = formFactory.createMultiLineTextWithLabel(this, "Annotation", 100, style);
}
/* (non-Javadoc)
.createSelectionElement(AgentBase.class,
getConversationHolder(), this, "Agent", null,
EntitySelectionElement.ALL, style);
- text = formFactory.createMultilineTextWithLabel(this, "Text", 100,
+ text = formFactory.createMultiLineTextWithLabel(this, "Text", 100,
style);
}
selection_agent = formFactory.createSelectionElement(
AgentBase.class, getConversationHolder(), this, "Agent",
null, EntitySelectionElement.ALL, style);
- text = formFactory.createMultilineTextWithLabel(this, "Text", 100,
+ text = formFactory.createMultiLineTextWithLabel(this, "Text", 100,
style);
}
\r
text_label = formFactory.createTextWithLabelElement(formElement, "Label", representation.getLabel(), style);\r
text_abbreviatedLabel = formFactory.createTextWithLabelElement(formElement, "Abbrev. Label", representation.getAbbreviatedLabel(), style);\r
- text_description = formFactory.createMultilineTextWithLabel(formElement, "Description", 100, style);\r
+ text_description = formFactory.createMultiLineTextWithLabel(formElement, "Description", 100, style);\r
text_description.setText(representation.getDescription());\r
uri_uri = formFactory.createUriWithLabelElement(formElement, "URI", getEntity().getUri(), style);\r
\r