Search in sources :

Example 1 with LookupComponent

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

the class TOCDetailsHooksPFTD method setViewDisable.

private void setViewDisable(final ViewDefinitionState view) {
    FormComponent tocForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    if (tocForm.getEntityId() == null) {
        return;
    }
    Entity technology = tocForm.getPersistedEntityWithIncludedFormValues().getBelongsToField(TechnologyOperationComponentFields.TECHNOLOGY);
    LookupComponent divisionookupComponent = (LookupComponent) view.getComponentByReference("division");
    LookupComponent plLookupComponent = (LookupComponent) view.getComponentByReference("productionLine");
    if (Range.ONE_DIVISION.getStringValue().equals(technology.getStringField(TechnologyFieldsPFTD.RANGE))) {
        divisionookupComponent.setEnabled(false);
        if (technology.getBelongsToField("productionLine") == null) {
            plLookupComponent.setEnabled(true);
        } else {
            plLookupComponent.setEnabled(false);
        }
    } else {
        divisionookupComponent.setEnabled(true);
        plLookupComponent.setEnabled(true);
    }
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 2 with LookupComponent

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

the class TechnologyDetailsListenersPFTD method setWorkstationsLookup.

public void setWorkstationsLookup(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
    if (!(componentState instanceof GridComponent)) {
        return;
    }
    GridComponent grid = (GridComponent) componentState;
    if (grid.getSelectedEntities().isEmpty()) {
        return;
    }
    LookupComponent workstationLookup = (LookupComponent) view.getComponentByReference("workstationsForTOClookup");
    Entity productionLine = grid.getSelectedEntities().get(0).getBelongsToField("productionLine");
    FilterValueHolder filter = workstationLookup.getFilterValue();
    if (Objects.nonNull(productionLine)) {
        filter.put(OperationFields.PRODUCTION_LINE, productionLine.getId());
    } else {
        filter.remove(OperationFields.PRODUCTION_LINE);
    }
    workstationLookup.setFilterValue(filter);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent) GridComponent(com.qcadoo.view.api.components.GridComponent)

Example 3 with LookupComponent

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

the class OperationDetailsHooks method setProductionLineCriteriaModifiers.

private void setProductionLineCriteriaModifiers(final ViewDefinitionState view) {
    LookupComponent productionLineLookup = (LookupComponent) view.getComponentByReference(OperationFields.PRODUCTION_LINE);
    LookupComponent divisionLookup = (LookupComponent) view.getComponentByReference(OperationFields.DIVISION);
    Entity division = divisionLookup.getEntity();
    FilterValueHolder filter = productionLineLookup.getFilterValue();
    if (division != null) {
        filter.put(OperationFields.DIVISION, division.getId());
    } else {
        filter.remove(OperationFields.DIVISION);
    }
    productionLineLookup.setFilterValue(filter);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 4 with LookupComponent

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

the class WarehouseIssueDetailHooks method setCriteriaModifierParameters.

public void setCriteriaModifierParameters(final ViewDefinitionState view, final Entity order) {
    LookupComponent technologyOperationComponentLookup = (LookupComponent) view.getComponentByReference(WarehouseIssueFields.TECHNOLOGY_OPERATION_COMPONENT);
    LookupComponent divisionLookup = (LookupComponent) view.getComponentByReference(WarehouseIssueFields.DIVISION);
    if (Objects.nonNull(order)) {
        Entity technology = order.getBelongsToField(OrderFields.TECHNOLOGY);
        if (Objects.nonNull(technology)) {
            FilterValueHolder filterValueHolder = technologyOperationComponentLookup.getFilterValue();
            filterValueHolder.put(OrderFields.TECHNOLOGY, technology.getId());
            technologyOperationComponentLookup.setFilterValue(filterValueHolder);
            FilterValueHolder divisionFilterValueHolder = divisionLookup.getFilterValue();
            divisionFilterValueHolder.put(OrderFields.TECHNOLOGY, technology.getId());
            divisionLookup.setFilterValue(divisionFilterValueHolder);
        }
    }
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 5 with LookupComponent

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

the class TOCDetailsHooksPFTD method onBeforeRender.

public void onBeforeRender(final ViewDefinitionState view) {
    FormComponent tocForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    if (tocForm.getEntityId() == null) {
        return;
    }
    Entity technology = tocForm.getPersistedEntityWithIncludedFormValues().getBelongsToField(TechnologyOperationComponentFields.TECHNOLOGY);
    LookupComponent divisionLookupComponent = (LookupComponent) view.getComponentByReference("division");
    divisionLookupComponent.setEnabled(!Range.ONE_DIVISION.getStringValue().equals(technology.getStringField(TechnologyFieldsPFTD.RANGE)));
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) 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