periodLabel = new Label(composite, SWT.NULL);
periodLabel.setText("Per�odo:");
periodLabel.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
periodLabel.setEnabled(true);
final GDDate today = new GDDate();
startPeriodText = new DateText(composite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
startPeriodText.setValue(today.getDate());
data = new GridData();
data.widthHint = 80;
startPeriodText.setLayoutData(data);
final Label atLabel = new Label(composite, SWT.NULL);
atLabel.setText(" � ");
atLabel.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
atLabel.setEnabled(true);
endPeriodText = new DateText(composite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
endPeriodText.setValue(today.getDate());
endPeriodText.setEnabled(true);
data = new GridData();
data.widthHint = 80;
endPeriodText.setLayoutData(data);
combo.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event arg0) {
setPeriod(combo.getSelectionIndex());
if (combo.getSelectionIndex() == 0) {
periodLabel.setEnabled(true);
atLabel.setEnabled(true);
startPeriodText.setEnabled(true);
endPeriodText.setEnabled(true);
} else {
periodLabel.setEnabled(false);
atLabel.setEnabled(false);
startPeriodText.setEnabled(false);
endPeriodText.setEnabled(false);
}
}
});
filter = new Button(composite, SWT.FLAT);
filter.setText("Filtrar");
filter.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event arg0) {
if(new GDDate(endPeriodText.getText()).beforeDay(new GDDate(startPeriodText.getText()))){
cashFlowControlCenter.setErrorMessage("A data inicial deve ser menor que a data final.");
startPeriodText.setFocus();
}else if ((new GDDate(startPeriodText.getText()).beforeDay(new GDDate()))){
cashFlowControlCenter.setErrorMessage("A data inicial deve ser maior ou igual a data atual.");
startPeriodText.setFocus();
} else {
updateFilters();
}