-// $Id$
/**
* Copyright (C) 2007 EDIT
* European Distributed Institute of Taxonomy
*/
public class DateDetailSection extends AbstractFormSection<TimePeriod> {
- private final TextWithLabelElement text_freeText;
- private final PartialElement partialElement_start;
- private final PartialElement partialElement_end;
- private final TextWithLabelElement text_parseText;
+ protected TextWithLabelElement text_freeText;
+ private PartialElement partialElement_start;
+ private PartialElement partialElement_end;
+ private TextWithLabelElement text_parseText;
private int cursorPosition;
- /**
+ public int getCursorPosition() {
+ return cursorPosition;
+ }
+
+ public void setCursorPosition(int cursorPosition) {
+ this.cursorPosition = cursorPosition;
+ }
+
+ /**
* <p>
* Constructor for DateDetailSection.
* </p>
partialElement_end = formFactory.createPartialElement(this, "End ",
null, style);
- text_parseText = formFactory.createTextWithLabelElement(this, "Parse",
- null, style);
- text_parseText.getMainControl().setLayoutData(
+ setText_parseText(formFactory.createTextWithLabelElement(this, "Parse",
+ null, style));
+ getText_parseText().getMainControl().setLayoutData(
LayoutConstants.FILL_HORIZONTALLY(6, 1));
text_freeText = formFactory.createTextWithLabelElement(this,
text_freeText.getMainControl().setLayoutData(
LayoutConstants.FILL_HORIZONTALLY(6, 1));
+
formFactory.addPropertyChangeListener(this);
}
public void setEntity(TimePeriod timePeriod) {
setEntityInternally(timePeriod);
updateTitle();
- text_parseText.setText(timePeriod.toString());
+ getText_parseText().setText(timePeriod.toString());
}
/**
* When setting the entity through parsing we do not want to alter the parse field
* @param timePeriod
*/
- private void setEntityInternally(TimePeriod timePeriod){
+ protected void setEntityInternally(TimePeriod timePeriod){
Partial start = timePeriod.getStart();
partialElement_start.setPartial(start);
Partial end = timePeriod.getEnd();
partialElement_end.setPartial(end);
- ((Text) text_parseText.getMainControl()).setSelection(cursorPosition);
+ ((Text) getText_parseText().getMainControl()).setSelection(cursorPosition);
text_freeText.setText(timePeriod.getFreeText());
super.setEntity(timePeriod);
event.getException()));
}
- private void handleEvent(Object eventSource) {
+ protected void handleEvent(Object eventSource) {
if (eventSource == partialElement_start) {
Partial start = partialElement_start.getPartial();
getEntity().setStart(start);
} else if (eventSource == partialElement_end) {
Partial end = partialElement_end.getPartial();
getEntity().setEnd(end);
- } else if (eventSource == text_parseText) {
- cursorPosition = ((Text) text_parseText.getMainControl())
+ } else if (eventSource == getText_parseText()) {
+ cursorPosition = ((Text) getText_parseText().getMainControl())
.getCaretPosition();
- setEntityInternally(TimePeriodParser.parseString(text_parseText.getText()));
+ setEntityInternally(TimePeriodParser.parseString(getText_parseText().getText()));
} else if (eventSource == text_freeText) {
getEntity().setFreeText(text_freeText.getText());
}
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
- private void updateTitle(){
+ protected void updateTitle(){
String title = CdmUtils.Nz(getEntity().toString());
this.setText(title);
layout();
super.dispose();
}
+ public TextWithLabelElement getText_parseText() {
+ return text_parseText;
+ }
+
+ public void setText_parseText(TextWithLabelElement text_parseText) {
+ this.text_parseText = text_parseText;
+ }
+
}