Search in sources :

Example 76 with LookupComponent

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

the class MachinePartForEventDetailsHooks method disableFieldsForIssuedPart.

public void disableFieldsForIssuedPart(final ViewDefinitionState view) {
    FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity machinePartForEvent = form.getPersistedEntityWithIncludedFormValues();
    BigDecimal issuedQuantity = machinePartForEvent.getDecimalField(MachinePartForEventFields.ISSUED_QUANTITY);
    if (issuedQuantity != null && issuedQuantity.compareTo(BigDecimal.ZERO) > 0) {
        LookupComponent machinePart = (LookupComponent) view.getComponentByReference(MachinePartForEventFields.MACHINE_PART);
        LookupComponent warehouse = (LookupComponent) view.getComponentByReference(MachinePartForEventFields.WAREHOUSE);
        machinePart.setEnabled(false);
        warehouse.setEnabled(false);
    }
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent) BigDecimal(java.math.BigDecimal)

Example 77 with LookupComponent

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

the class MachinePartForEventDetailsHooks method setWarehouseLookup.

private void setWarehouseLookup(final ViewDefinitionState view, final Entity factory) {
    if (factory != null) {
        LookupComponent warehouseLookup = (LookupComponent) view.getComponentByReference(MachinePartForEventFields.WAREHOUSE);
        Entity warehouse = factory.getBelongsToField("warehouse");
        if (warehouse != null && warehouseLookup.getFieldValue() == null) {
            warehouseLookup.setFieldValue(warehouse.getId());
        }
    }
}
Also used : Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 78 with LookupComponent

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

the class DocumentDetailsListenersCMP method clearEvents.

public void clearEvents(final ViewDefinitionState viewDefinitionState, final ComponentState triggerState, final String[] args) {
    FormComponent form = (FormComponent) viewDefinitionState.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity document = form.getPersistedEntityWithIncludedFormValues();
    String type = document.getStringField(DocumentFields.TYPE);
    if (type.compareTo(DocumentType.INTERNAL_OUTBOUND.getStringValue()) != 0) {
        LookupComponent mEventLookup = (LookupComponent) viewDefinitionState.getComponentByReference(DocumentFieldsCMP.MAINTENANCE_EVENT);
        mEventLookup.setFieldValue(null);
        LookupComponent pEventLookup = (LookupComponent) viewDefinitionState.getComponentByReference(DocumentFieldsCMP.PLANNED_EVENT);
        pEventLookup.setFieldValue(null);
    }
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 79 with LookupComponent

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

the class EventListeners method checkAndShow.

private boolean checkAndShow(final String modelName, final String viewName, final ViewDefinitionState view) {
    LookupComponent lookup = (LookupComponent) view.getComponentByReference(modelName);
    if (lookup.getEntity() != null) {
        String url = "../page/cmmsMachineParts/" + viewName + ".html?context={\"" + modelName + ".id\":\"" + lookup.getEntity().getId() + "\"}";
        view.openModal(url);
        return true;
    }
    return false;
}
Also used : LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 80 with LookupComponent

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

the class EventListeners method clearFilterForFaultType.

private void clearFilterForFaultType(final ViewDefinitionState view, final String field) {
    LookupComponent faultType = (LookupComponent) view.getComponentByReference(MaintenanceEventFields.FAULT_TYPE);
    if (faultType != null) {
        FilterValueHolder filter = faultType.getFilterValue();
        if (filter.has(field)) {
            filter.remove(field);
            filter.remove(WorkstationFields.WORKSTATION_TYPE);
        }
        faultType.setFilterValue(filter);
    }
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Aggregations

LookupComponent (com.qcadoo.view.api.components.LookupComponent)277 Entity (com.qcadoo.model.api.Entity)182 FieldComponent (com.qcadoo.view.api.components.FieldComponent)105 FormComponent (com.qcadoo.view.api.components.FormComponent)102 FilterValueHolder (com.qcadoo.view.api.components.lookup.FilterValueHolder)69 BigDecimal (java.math.BigDecimal)16 CheckBoxComponent (com.qcadoo.view.api.components.CheckBoxComponent)12 GridComponent (com.qcadoo.view.api.components.GridComponent)11 WindowComponent (com.qcadoo.view.api.components.WindowComponent)8 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)7 Date (java.util.Date)6 JSONObject (org.json.JSONObject)6 ComponentState (com.qcadoo.view.api.ComponentState)5 AwesomeDynamicListComponent (com.qcadoo.view.api.components.AwesomeDynamicListComponent)5 JSONException (org.json.JSONException)5 DataDefinition (com.qcadoo.model.api.DataDefinition)3 RibbonGroup (com.qcadoo.view.api.ribbon.RibbonGroup)3 Optional (com.google.common.base.Optional)2 ProductFields (com.qcadoo.mes.basic.constants.ProductFields)2 DataDefinitionService (com.qcadoo.model.api.DataDefinitionService)2