Package jimm.datavision.gui.parameter

Source Code of jimm.datavision.gui.parameter.SingleDateInq

package jimm.datavision.gui.parameter;
import jimm.datavision.Parameter;
import java.util.Date;
import java.util.Calendar;
import javax.swing.*;
import com.toedter.calendar.JCalendar;

/**
* A single date inquisitor knows how to display and control the widgets
* needed to ask a user for a date parameter value.
*
* @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
*/
class SingleDateInq extends Inquisitor {

protected JCalendar cal;

SingleDateInq(Parameter param) {
    super(param);

    // Build GUI. Use current date as default value.
    JPanel innerPanel = new JPanel();
    innerPanel.add(cal = new JCalendar());
    panel.add(innerPanel);

    // Copy default value into "real" value. Default value is the
    // current date and time.
    parameter.setValue(0, parameter.getDefaultValue(0));
}

void copyGUIIntoParam() {
    parameter.setValue(0, cal.getCalendar().getTime());
}

void copyParamIntoGUI() {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime((Date)parameter.getValue(0));
    cal.setCalendar(calendar);
}

}
TOP

Related Classes of jimm.datavision.gui.parameter.SingleDateInq

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.