Search in sources :

Example 66 with FormComponent

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

the class NegotiationDetailsListeners method showOffersItemsForGivenNegotiation.

public final void showOffersItemsForGivenNegotiation(final ViewDefinitionState view, final ComponentState state, final String[] args) {
    FormComponent negotiationForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity negotiation = negotiationForm.getEntity();
    if (negotiation.getId() == null) {
        return;
    }
    String negotiationNumber = negotiation.getStringField(NUMBER);
    if (negotiationNumber == null) {
        return;
    }
    Map<String, String> filters = Maps.newHashMap();
    filters.put(L_NEGOTIATION_NUMBER, negotiationNumber);
    Map<String, Object> gridOptions = Maps.newHashMap();
    gridOptions.put(L_FILTERS, filters);
    Map<String, Object> parameters = Maps.newHashMap();
    parameters.put(L_GRID_OPTIONS, gridOptions);
    parameters.put(L_WINDOW_ACTIVE_MENU, "requirements.offersItems");
    String url = "../page/supplyNegotiations/offersItems.html";
    view.redirectTo(url, false, true, parameters);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity)

Example 67 with FormComponent

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

the class ProductionTrackingDetailsHooksTSFPC method disabledSubcontractorFieldForState.

public void disabledSubcontractorFieldForState(final ViewDefinitionState view) {
    FormComponent productionTrackingForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    LookupComponent subcontractorLookup = (LookupComponent) view.getComponentByReference(ProductionTrackingFieldsTSFPC.SUBCONTRACTOR);
    if (productionTrackingForm.getEntityId() == null) {
        return;
    }
    Entity productionTracking = getProductionTrackingFromDB(productionTrackingForm.getEntityId());
    String state = productionTracking.getStringField(ProductionTrackingFields.STATE);
    boolean isDraft = ProductionTrackingStateStringValues.DRAFT.equals(state);
    boolean isExternalSynchronized = productionTracking.getBooleanField(ProductionTrackingFields.IS_EXTERNAL_SYNCHRONIZED);
    subcontractorLookup.setEnabled(isDraft && isExternalSynchronized);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 68 with FormComponent

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

the class MaterialRequirementDetailsHooksTS method setMrpAlgoritmValue.

public void setMrpAlgoritmValue(final ViewDefinitionState view) {
    FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    if (form.getEntityId() != null) {
        return;
    }
    FieldComponent mrpAlgoritm = (FieldComponent) view.getComponentByReference("mrpAlgorithm");
    mrpAlgoritm.setFieldValue(COMPONENTS_AND_SUBCONTRACTORS_PRODUCTS.getStringValue());
    mrpAlgoritm.requestComponentUpdateState();
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 69 with FormComponent

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

the class TechnologyService method setLookupDisableInTechnologyOperationComponent.

public void setLookupDisableInTechnologyOperationComponent(final ViewDefinitionState view) {
    FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    FieldComponent operationLookup = (FieldComponent) view.getComponentByReference(L_OPERATION);
    operationLookup.setEnabled(Objects.isNull(form.getEntityId()));
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 70 with FormComponent

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

the class TechnologyTreeNumberingHooks method rebuildTreeNumbering.

public void rebuildTreeNumbering(final ViewDefinitionState view) {
    FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Long technologyId = form.getEntityId();
    if (technologyId == null) {
        return;
    }
    Entity technology = getTechnologyById(technologyId);
    if (!isDraftTechnology(technology)) {
        return;
    }
    EntityTree technologyTree = technology.getTreeField(TechnologyFields.OPERATION_COMPONENTS);
    if (technologyTree == null || technologyTree.getRoot() == null) {
        return;
    }
    debug("Fire tree node number generator for tecnology with id = " + technologyId);
    treeNumberingService.generateTreeNumbers(technologyTree);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) EntityTree(com.qcadoo.model.api.EntityTree)

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