return OmniLinkBBClient.getString(OmniLinkClientResource.TEMPERATURE);
}
public Field[] getFields() {
// Current Temperature
Field currentTemperatureField = createLabelAndTextField(OmniLinkBBClient.getString(OmniLinkClientResource.TEMPERATURE_CURRENT), String.valueOf(thermostatModel.getCurrentTemperature()));
// Min temperature
Double minTemperature = new Double(thermostatModel.getMinTemperature());
Execution exec = new Execution() {
public boolean execute(Object selection) {
Double selectedMinTemp = (Double) selection;
return thermostatModel.setMinTemperature(selectedMinTemp.doubleValue());
}
};
Field minTempChoiceField = createLabelAndChoiceField(OmniLinkBBClient.getString(OmniLinkClientResource.TEMPERATURE_MIN), TEMPERATURES, minTemperature, exec);
// Max temperature
Double maxTemperature = new Double(thermostatModel.getMaxTemperature());
exec = new Execution() {
public boolean execute(Object selection) {
Double selectedMaxTemp = (Double) selection;
return thermostatModel.setMaxTemperature(selectedMaxTemp.doubleValue());
}
};
Field maxTempChoiceField = createLabelAndChoiceField(OmniLinkBBClient.getString(OmniLinkClientResource.TEMPERATURE_MAX), TEMPERATURES, maxTemperature, exec);
// Fan mode
EnumLabel fanModeLabel = EnumLabel.getEnumLabel(FAN_MODES, thermostatModel.getFanMode());
exec = new Execution() {
public boolean execute(Object selection) {
FanMode selectedFanMode = (FanMode) ((EnumLabel) selection).getEnumValue();
return thermostatModel.setFanMode(selectedFanMode);
}
};
Field fanModeField = createLabelAndChoiceField(OmniLinkBBClient.getString(OmniLinkClientResource.TEMPERATURE_FAN_MODE), FAN_MODES, fanModeLabel, exec);
// Hold mode
EnumLabel holdModeLabel = EnumLabel.getEnumLabel(HOLD_MODES, thermostatModel.getHoldMode());
exec = new Execution() {
public boolean execute(Object selection) {
HoldMode selectedHoldMode = (HoldMode) ((EnumLabel) selection).getEnumValue();
return thermostatModel.setHoldMode(selectedHoldMode);
}
};
Field holdModeField = createLabelAndChoiceField(OmniLinkBBClient.getString(OmniLinkClientResource.TEMPERATURE_HOLD_MODE), HOLD_MODES, holdModeLabel, exec);
// System mode
EnumLabel systemModeLabel = EnumLabel.getEnumLabel(SYSTEM_MODES, thermostatModel.getSystemMode());
exec = new Execution() {
public boolean execute(Object selection) {
SystemMode selectedSystemMode = (SystemMode) ((EnumLabel) selection).getEnumValue();
return thermostatModel.setSystemMode(selectedSystemMode);
}
};
Field systemModeField = createLabelAndChoiceField(OmniLinkBBClient.getString(OmniLinkClientResource.TEMPERATURE_SYSTEM_MODE), SYSTEM_MODES, systemModeLabel, exec);
return new Field[] {currentTemperatureField, minTempChoiceField, maxTempChoiceField, fanModeField, holdModeField, systemModeField};
}