Search in sources :

Example 61 with FormComponent

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

the class NegotiationDetailsHooks method changeFieldsEnabled.

private void changeFieldsEnabled(final ViewDefinitionState view, final boolean enabledForm, final boolean enabledGrid) {
    FormComponent negotiationForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    GridComponent negotiationProducts = (GridComponent) view.getComponentByReference(NEGOTIATION_PRODUCTS);
    negotiationForm.setFormEnabled(enabledForm);
    negotiationProducts.setEnabled(enabledGrid);
    negotiationProducts.setEditable(enabledGrid);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) GridComponent(com.qcadoo.view.api.components.GridComponent)

Example 62 with FormComponent

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

the class NegotiationDetailsHooks method changeFieldsEnabledDependOnState.

public void changeFieldsEnabledDependOnState(final ViewDefinitionState view) {
    FormComponent negotiationForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    FieldComponent stateField = (FieldComponent) view.getComponentByReference(STATE);
    String state = stateField.getFieldValue().toString();
    if (negotiationForm.getEntityId() == null) {
        changeFieldsEnabled(view, true, false);
    } else {
        if (COMPLETED.equals(state) || DECLINED.equals(state) || GENERATED_REQUESTS.equals(state)) {
            changeFieldsEnabled(view, false, false);
        } else {
            changeFieldsEnabled(view, true, true);
        }
    }
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 63 with FormComponent

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

the class CompanyDetailsListenersSN method redirectToFilteredOffersList.

public void redirectToFilteredOffersList(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
    FormComponent companyForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity company = companyForm.getEntity();
    if (company.getId() == null) {
        return;
    }
    String supplierName = company.getStringField("name");
    Map<String, String> filters = Maps.newHashMap();
    filters.put("supplierName", supplierName);
    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.offer");
    String url = "../page/supplyNegotiations/offersList.html";
    view.redirectTo(url, false, true, parameters);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity)

Example 64 with FormComponent

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

the class NegotiationDetailsListeners method showOffersForGivenNegotiation.

public final void showOffersForGivenNegotiation(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.offer");
    String url = "../page/supplyNegotiations/offersList.html";
    view.redirectTo(url, false, true, parameters);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity)

Example 65 with FormComponent

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

the class NegotiationDetailsListeners method showRequestForQuotationsForGivenNegotiation.

public final void showRequestForQuotationsForGivenNegotiation(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.requestsForQuotation");
    String url = "../page/supplyNegotiations/requestForQuotationsList.html";
    view.redirectTo(url, false, true, parameters);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity)

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