Search in sources :

Example 1 with SelectComponentState

use of com.qcadoo.view.internal.components.select.SelectComponentState in project mes by qcadoo.

the class PlannedEventDetailsHooks method setUnit.

public void setUnit(final ViewDefinitionState view) {
    SelectComponentState basedOnSelect = (SelectComponentState) view.getComponentByReference(PlannedEventFields.BASED_ON);
    FieldComponent toleranceUnitField = (FieldComponent) view.getComponentByReference("toleranceUnit");
    switch(PlannedEventBasedOn.parseString((String) basedOnSelect.getFieldValue())) {
        case COUNTER:
            toleranceUnitField.setFieldValue(translationService.translate("cmmsMachineParts.plannedEvent.toleranceUnit.mh", view.getLocale()));
            break;
        case DATE:
            toleranceUnitField.setFieldValue(translationService.translate("cmmsMachineParts.plannedEvent.toleranceUnit.days", view.getLocale()));
            break;
    }
}
Also used : SelectComponentState(com.qcadoo.view.internal.components.select.SelectComponentState)

Example 2 with SelectComponentState

use of com.qcadoo.view.internal.components.select.SelectComponentState in project mes by qcadoo.

the class TimeUsageReportHooks method onBeforeRender.

public final void onBeforeRender(final ViewDefinitionState view) {
    SelectComponentState workersSelection = (SelectComponentState) view.getComponentByReference("workersSelection");
    GridComponent workersGrid = (GridComponent) view.getComponentByReference("workers");
    String selected = (String) workersSelection.getFieldValue();
    if ("01all".equals(selected)) {
        workersGrid.setEntities(Collections.emptyList());
        workersGrid.setEnabled(false);
    } else {
        workersGrid.setEnabled(true);
    }
}
Also used : SelectComponentState(com.qcadoo.view.internal.components.select.SelectComponentState) GridComponent(com.qcadoo.view.api.components.GridComponent)

Aggregations

SelectComponentState (com.qcadoo.view.internal.components.select.SelectComponentState)2 GridComponent (com.qcadoo.view.api.components.GridComponent)1