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);
}
}
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());
}
}
}
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);
}
}
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;
}
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);
}
}
Aggregations