Search in sources :

Example 1 with FormPanel

use of com.extjs.gxt.ui.client.widget.form.FormPanel in project activityinfo by bedatadriven.

the class EmailDialog method createLayout.

public void createLayout() {
    FormPanel form = new FormPanel();
    form.setHeaderVisible(false);
    form.setLabelWidth(100);
    setLayout(new FitLayout());
    add(form);
    none = new Radio();
    none.setBoxLabel(I18N.CONSTANTS.none());
    weekly = new Radio();
    weekly.setBoxLabel(I18N.CONSTANTS.weekly());
    weekly.setValue(true);
    monthly = new Radio();
    monthly.setBoxLabel(I18N.CONSTANTS.monthly());
    emailFrequency = new RadioGroup();
    emailFrequency.setFieldLabel(I18N.CONSTANTS.emailFrequency());
    emailFrequency.setOrientation(Orientation.VERTICAL);
    emailFrequency.add(none);
    emailFrequency.add(weekly);
    emailFrequency.add(monthly);
    form.add(emailFrequency);
    dayOfWeek = new MappingComboBox<Integer>();
    dayOfWeek.setAllowBlank(false);
    dayOfWeek.setEditable(false);
    dayOfWeek.setFieldLabel(I18N.CONSTANTS.dayOfWeek());
    String[] weekDays = LocaleInfo.getCurrentLocale().getDateTimeConstants().weekdays();
    for (int i = 0; i != weekDays.length; ++i) {
        dayOfWeek.add(i + 1, weekDays[i]);
    }
    form.add(dayOfWeek);
    dayOfMonth = new MappingComboBox<Integer>();
    dayOfMonth.setEditable(false);
    dayOfMonth.hide();
    dayOfMonth.setFieldLabel(I18N.CONSTANTS.dayOfMonth());
    for (int i = 1; i <= 31; i++) {
        dayOfMonth.add(i, String.valueOf(i));
    }
    form.add(dayOfMonth);
    emailFrequency.addListener(Events.Change, new Listener<BaseEvent>() {

        @Override
        public void handleEvent(BaseEvent be) {
            if (weekly.getValue()) {
                showWeek();
            } else if (monthly.getValue()) {
                showMonth();
            }
        }
    });
}
Also used : FormPanel(com.extjs.gxt.ui.client.widget.form.FormPanel) RadioGroup(com.extjs.gxt.ui.client.widget.form.RadioGroup) BaseEvent(com.extjs.gxt.ui.client.event.BaseEvent) Radio(com.extjs.gxt.ui.client.widget.form.Radio) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Aggregations

BaseEvent (com.extjs.gxt.ui.client.event.BaseEvent)1 FormPanel (com.extjs.gxt.ui.client.widget.form.FormPanel)1 Radio (com.extjs.gxt.ui.client.widget.form.Radio)1 RadioGroup (com.extjs.gxt.ui.client.widget.form.RadioGroup)1 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)1