use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class GenerateTimeGapsViewHooks method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState viewState) {
CheckBoxComponent isInitializedCheckbox = (CheckBoxComponent) viewState.getComponentByReference("viewIsInitialized");
if (!isInitializedCheckbox.isChecked()) {
setLowerTimeBoundOnEntry(viewState);
isInitializedCheckbox.setChecked(true);
}
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class EventHooks method manageSoundNotificationsField.
private void manageSoundNotificationsField(final ViewDefinitionState view) {
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Entity event = form.getPersistedEntityWithIncludedFormValues();
String type = event.getStringField(MaintenanceEventFields.TYPE);
String eventState = event.getStringField(MaintenanceEventFields.STATE);
boolean canEnableSoundNotificationsField = canEnableSoundNotificationsField(view, type, eventState);
CheckBoxComponent soundNotificationComponent = (CheckBoxComponent) view.getComponentByReference(MaintenanceEventFields.SOUND_NOTIFICATIONS);
if (form.getEntityId() == null && view.isViewAfterRedirect() && canEnableSoundNotificationsField) {
soundNotificationComponent.setChecked(true);
} else if (MaintenanceEventType.PROPOSAL.getStringValue().equals(type)) {
soundNotificationComponent.setChecked(false);
}
soundNotificationComponent.setEnabled(canEnableSoundNotificationsField);
soundNotificationComponent.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class ParametersListenersO method onRealizationFromStock.
public void onRealizationFromStock(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
CheckBoxComponent realizationFromStockComponent = (CheckBoxComponent) view.getComponentByReference(L_REALIZATION_FROM_STOCK);
CheckBoxComponent alwaysOrderItemsWithPersonalizationComponent = (CheckBoxComponent) view.getComponentByReference(L_ALWAYS_ORDER_ITEMS_WITH_PERSONALIZATION);
GridComponent realizationLocationsGrid = (GridComponent) view.getComponentByReference(L_REALIZATION_LOCATIONS);
if (realizationFromStockComponent.isChecked()) {
alwaysOrderItemsWithPersonalizationComponent.setEnabled(true);
realizationLocationsGrid.setEditable(true);
} else {
alwaysOrderItemsWithPersonalizationComponent.setChecked(false);
alwaysOrderItemsWithPersonalizationComponent.setEnabled(false);
realizationLocationsGrid.setEntities(Lists.newArrayList());
realizationLocationsGrid.setEditable(false);
}
alwaysOrderItemsWithPersonalizationComponent.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class ParametersListenersO method onAutomaticallyGenerateTasksForOrder.
public void onAutomaticallyGenerateTasksForOrder(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
CheckBoxComponent automaticallyGenerateTasksForOrder = (CheckBoxComponent) view.getComponentByReference(L_AUTOMATICALLY_GENERATE_TASKS_FOR_ORDER);
CheckBoxComponent completeStationAndEmployeeInGeneratedTasks = (CheckBoxComponent) view.getComponentByReference(L_COMPLETE_STATION_AND_EMPLOYEE_IN_GENERATED_TASKS);
if (automaticallyGenerateTasksForOrder.isChecked()) {
completeStationAndEmployeeInGeneratedTasks.setEnabled(true);
} else {
completeStationAndEmployeeInGeneratedTasks.setEnabled(false);
completeStationAndEmployeeInGeneratedTasks.setChecked(false);
}
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class ParametersHooksO method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
showTimeFields(view);
CheckBoxComponent realizationFromStockComponent = (CheckBoxComponent) view.getComponentByReference(L_REALIZATION_FROM_STOCK);
CheckBoxComponent alwaysOrderItemsWithPersonalizationComponent = (CheckBoxComponent) view.getComponentByReference(L_ALWAYS_ORDER_ITEMS_WITH_PERSONALIZATION);
GridComponent realizationLocationsGrid = (GridComponent) view.getComponentByReference(L_REALIZATION_LOCATIONS);
if (realizationFromStockComponent.isChecked()) {
alwaysOrderItemsWithPersonalizationComponent.setEnabled(true);
realizationLocationsGrid.setEditable(true);
} else {
alwaysOrderItemsWithPersonalizationComponent.setEnabled(false);
realizationLocationsGrid.setEditable(false);
}
alwaysOrderItemsWithPersonalizationComponent.requestComponentUpdateState();
CheckBoxComponent adviseStartDateOfTheOrder = (CheckBoxComponent) view.getComponentByReference(ParameterFieldsO.ADVISE_START_DATE_OF_THE_ORDER);
FieldComponent orderStartDateBasedOn = (FieldComponent) view.getComponentByReference(ParameterFieldsO.ORDER_START_DATE_BASED_ON);
if (adviseStartDateOfTheOrder.isChecked()) {
orderStartDateBasedOn.setEnabled(true);
} else {
orderStartDateBasedOn.setEnabled(false);
orderStartDateBasedOn.setFieldValue(null);
}
CheckBoxComponent generatePacksForOrders = (CheckBoxComponent) view.getComponentByReference(GENERATE_PACKS_FOR_ORDERS);
FieldComponent optimalPackSize = (FieldComponent) view.getComponentByReference(OPTIMAL_PACK_SIZE);
FieldComponent restFeedingLastPack = (FieldComponent) view.getComponentByReference(REST_FEEDING_LAST_PACK);
if (generatePacksForOrders.isChecked()) {
optimalPackSize.setEnabled(true);
optimalPackSize.setRequired(true);
restFeedingLastPack.setEnabled(true);
restFeedingLastPack.setRequired(true);
} else {
optimalPackSize.setEnabled(false);
optimalPackSize.setFieldValue(null);
optimalPackSize.setRequired(false);
restFeedingLastPack.setEnabled(false);
restFeedingLastPack.setFieldValue(null);
restFeedingLastPack.setRequired(false);
}
optimalPackSize.requestComponentUpdateState();
restFeedingLastPack.requestComponentUpdateState();
}
Aggregations