import eu.etaxonomy.taxeditor.preference.Resources;
/**
- * <p>
- * TextWithLabelElement class.
- * </p>
- *
* @author n.hoffmann
* @version $Id: $
*/
private final boolean isMultiLine;
- /** Constant <code>MAX_HEIGHT=0</code> */
public static final int MAX_HEIGHT = 0;
- /** Constant <code>SINGLE=-1</code> */
public static final int SINGLE = -1;
protected TextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, boolean isMultiLine) {
this(formFactory, parentElement, labelString, initialText, textHeight, textLimit, false, style);
}
- /**
- * <p>
- * Constructor for TextWithLabelElement.
- * </p>
- *
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param labelString
- * a {@link java.lang.String} object.
- * @param initialText
- * 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, Integer textLimit, boolean isMultiLine, int style) {
super(formFactory, parentElement);
init(formFactory, labelString, initialText, textHeight, textLimit, isMultiLine, style, getLayoutComposite());
}
- /**
- * @param formFactory
- * @param labelString
- * @param initialText
- * @param textHeight
- * @param textLimit
- * @param isMultiLine
- * @param style
- * @param layoutComposite
- */
protected void init(CdmFormFactory formFactory, String labelString, String initialText, Integer textHeight,
Integer textLimit, boolean isMultiLine, int style, Composite layoutComposite) {
if (labelString != null) {
}
else{
layoutData = LayoutConstants.FILL();
- layoutData.grabHorizontal = true;
}
if (textHeight != null && textHeight > 0) {
(layoutData).heightHint = textHeight;
}
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events
- * .ModifyEvent)
- */
/** {@inheritDoc} */
@Override
public void modifyText(ModifyEvent e) {
text.setForeground(getColor(symbolicName));
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement#isEnabled()
- */
@Override
public boolean isEnabled() {
return text.isEnabled();
setBackground(selected ? SELECTED : getPersistentBackground());
}
- /*
- * (non-Javadoc)
- *
- * @see eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#setFocus()
- */
/** {@inheritDoc} */
@Override
public void setFocus() {
text.setFocus();
}
- /**
- * <p>
- * getMainControl
- * </p>
- *
- * @return a {@link org.eclipse.swt.widgets.Control} object.
- */
public Control getMainControl() {
return text;
}
- /**
- * <p>
- * setTextLimit
- * </p>
- *
- * @param limit
- * a int.
- */
public void setTextLimit(int limit) {
text.setTextLimit(limit);
}