Search in sources :

Example 91 with CheckBoxComponent

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);
    }
}
Also used : CheckBoxComponent(com.qcadoo.view.api.components.CheckBoxComponent)

Example 92 with CheckBoxComponent

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();
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) CheckBoxComponent(com.qcadoo.view.api.components.CheckBoxComponent)

Example 93 with CheckBoxComponent

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();
}
Also used : GridComponent(com.qcadoo.view.api.components.GridComponent) CheckBoxComponent(com.qcadoo.view.api.components.CheckBoxComponent)

Example 94 with CheckBoxComponent

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);
    }
}
Also used : CheckBoxComponent(com.qcadoo.view.api.components.CheckBoxComponent)

Example 95 with CheckBoxComponent

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();
}
Also used : GridComponent(com.qcadoo.view.api.components.GridComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent) CheckBoxComponent(com.qcadoo.view.api.components.CheckBoxComponent)

Aggregations

CheckBoxComponent (com.qcadoo.view.api.components.CheckBoxComponent)100 FormComponent (com.qcadoo.view.api.components.FormComponent)38 Entity (com.qcadoo.model.api.Entity)33 FieldComponent (com.qcadoo.view.api.components.FieldComponent)30 GridComponent (com.qcadoo.view.api.components.GridComponent)19 LookupComponent (com.qcadoo.view.api.components.LookupComponent)11 Date (java.util.Date)7 JSONObject (org.json.JSONObject)7 BigDecimal (java.math.BigDecimal)6 ComponentState (com.qcadoo.view.api.ComponentState)4 WindowComponent (com.qcadoo.view.api.components.WindowComponent)4 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)4 IOException (java.io.IOException)4 MaterialFlowResourcesConstants (com.qcadoo.mes.materialFlowResources.constants.MaterialFlowResourcesConstants)2 DataDefinition (com.qcadoo.model.api.DataDefinition)2 DataDefinitionService (com.qcadoo.model.api.DataDefinitionService)2 SearchRestrictions (com.qcadoo.model.api.search.SearchRestrictions)2 ViewDefinitionState (com.qcadoo.view.api.ViewDefinitionState)2 AwesomeDynamicListComponent (com.qcadoo.view.api.components.AwesomeDynamicListComponent)2 Ribbon (com.qcadoo.view.api.ribbon.Ribbon)2