Search in sources :

Example 96 with FormComponent

use of com.qcadoo.view.api.components.FormComponent in project mes by qcadoo.

the class TechnologyListenersTN method checkOperationOutputQuantities.

public void checkOperationOutputQuantities(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
    FormComponent technologyForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    if (technologyForm.getEntityId() == null) {
        return;
    }
    Entity technology = technologyForm.getEntity();
    if (!TechnologyState.DRAFT.getStringValue().equals(technology.getStringField(TechnologyFields.STATE))) {
        return;
    }
    technology = technology.getDataDefinition().get(technology.getId());
    List<String> messages = normService.checkOperationOutputQuantities(technology);
    if (!messages.isEmpty()) {
        StringBuilder builder = new StringBuilder();
        for (String message : messages) {
            builder.append(message);
            builder.append(", ");
        }
        technologyForm.addMessage("technologies.technology.validate.error.invalidQuantity", MessageType.INFO, false, builder.toString());
    }
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity)

Example 97 with FormComponent

use of com.qcadoo.view.api.components.FormComponent in project mes by qcadoo.

the class WorkPlanDetailsHooks method disableFormForGeneratedWorkPlan.

final void disableFormForGeneratedWorkPlan(final ViewDefinitionState view) {
    FormComponent workPlanForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    CheckBoxComponent generatedCheckbox = (CheckBoxComponent) view.getComponentByReference(WorkPlanFields.GENERATED);
    if (workPlanForm == null) {
        return;
    }
    if (workPlanForm.getEntityId() == null) {
        view.getComponentByReference(WorkPlanFields.ORDERS).setEnabled(false);
        view.getComponentByReference(WorkPlanFields.WORK_PLAN_ORDER_COLUMNS).setEnabled(false);
    } else {
        boolean isEnabled = !generatedCheckbox.isChecked();
        view.getComponentByReference(WorkPlanFields.NAME).setEnabled(isEnabled);
        view.getComponentByReference(WorkPlanFields.TYPE).setEnabled(isEnabled);
        view.getComponentByReference(WorkPlanFields.DONT_PRINT_ORDERS_IN_WORK_PLANS).setEnabled(isEnabled);
        view.getComponentByReference(WorkPlanFields.ORDERS).setEnabled(isEnabled);
        view.getComponentByReference(WorkPlanFields.WORK_PLAN_ORDER_COLUMNS).setEnabled(isEnabled);
        view.getComponentByReference(WorkPlanFields.INPUT_PRODUCT_COLUMN_TO_SORT_BY).setEnabled(isEnabled);
        view.getComponentByReference(WorkPlanFields.ORDER_SORTING).setEnabled(isEnabled);
    }
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) CheckBoxComponent(com.qcadoo.view.api.components.CheckBoxComponent)

Example 98 with FormComponent

use of com.qcadoo.view.api.components.FormComponent in project mes by qcadoo.

the class OperationDetailsHooksWP method setOperationDefaultValues.

public final void setOperationDefaultValues(final ViewDefinitionState view) {
    FormComponent operationForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    if (operationForm.getEntityId() == null) {
        for (String fieldName : Lists.newArrayList(ParameterFieldsWP.IMAGE_URL_IN_WORK_PLAN)) {
            FieldComponent fieldComponent = (FieldComponent) view.getComponentByReference(fieldName);
            fieldComponent.setFieldValue(getParameterField(fieldName));
        }
    }
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 99 with FormComponent

use of com.qcadoo.view.api.components.FormComponent in project mes by qcadoo.

the class BasicProductionCountingDetailsHooks method setFieldEditableDependsOfOrderState.

private void setFieldEditableDependsOfOrderState(final ViewDefinitionState view) {
    FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    GridComponent grid = (GridComponent) view.getComponentByReference(L_GRID);
    Long formId = form.getEntityId();
    if (formId == null) {
        return;
    }
    Entity basicProductionCounting = form.getEntity();
    if (disableGrid(orderService.getOrder(basicProductionCounting.getBelongsToField(BasicProductionCountingFields.ORDER).getId()))) {
        grid.setEnabled(false);
    } else {
        boolean isLocked = progressModifyLockHelper.isLocked(orderService.getOrder(basicProductionCounting.getBelongsToField(BasicProductionCountingFields.ORDER).getId()));
        grid.setEnabled(!isLocked);
    }
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) GridComponent(com.qcadoo.view.api.components.GridComponent)

Example 100 with FormComponent

use of com.qcadoo.view.api.components.FormComponent in project mes by qcadoo.

the class DetailedProductionCountingAndProgressListHooks method setGridEditableDependsOfOrderState.

public void setGridEditableDependsOfOrderState(final ViewDefinitionState view) {
    FormComponent orderForm = (FormComponent) view.getComponentByReference(L_ORDER);
    GridComponent grid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
    Long orderId = orderForm.getEntityId();
    if (orderId == null) {
        return;
    }
    if (disable(orderService.getOrder(orderId))) {
        grid.setEnabled(false);
    } else {
        boolean isLocked = progressModifyLockHelper.isLocked(orderService.getOrder(orderId));
        grid.setEnabled(!isLocked);
    }
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) GridComponent(com.qcadoo.view.api.components.GridComponent)

Aggregations

FormComponent (com.qcadoo.view.api.components.FormComponent)644 Entity (com.qcadoo.model.api.Entity)501 FieldComponent (com.qcadoo.view.api.components.FieldComponent)183 LookupComponent (com.qcadoo.view.api.components.LookupComponent)104 GridComponent (com.qcadoo.view.api.components.GridComponent)83 BigDecimal (java.math.BigDecimal)55 WindowComponent (com.qcadoo.view.api.components.WindowComponent)52 FilterValueHolder (com.qcadoo.view.api.components.lookup.FilterValueHolder)45 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)42 CheckBoxComponent (com.qcadoo.view.api.components.CheckBoxComponent)39 RibbonGroup (com.qcadoo.view.api.ribbon.RibbonGroup)36 Date (java.util.Date)33 DataDefinition (com.qcadoo.model.api.DataDefinition)29 AwesomeDynamicListComponent (com.qcadoo.view.api.components.AwesomeDynamicListComponent)28 JSONObject (org.json.JSONObject)28 ComponentState (com.qcadoo.view.api.ComponentState)27 Transactional (org.springframework.transaction.annotation.Transactional)20 ViewDefinitionState (com.qcadoo.view.api.ViewDefinitionState)17 Optional (com.google.common.base.Optional)16 Ribbon (com.qcadoo.view.api.ribbon.Ribbon)16