Search in sources :

Example 41 with FieldComponent

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

the class ProductionAnalysisParametersHooks method fillComponentWithPercent.

private void fillComponentWithPercent(String componentName, ViewDefinitionState viewDefinitionState) {
    FieldComponent materialCostMarginProc = (FieldComponent) viewDefinitionState.getComponentByReference(componentName);
    materialCostMarginProc.setFieldValue("%");
    materialCostMarginProc.requestComponentUpdateState();
}
Also used : FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 42 with FieldComponent

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

the class ProductionAnalysisParametersHooks method fillCurrencyAndUnitFields.

public void fillCurrencyAndUnitFields(final ViewDefinitionState viewDefinitionState) {
    String currencyAlphabeticCode = currencyService.getCurrencyAlphabeticCode();
    List<String> currencyFieldNames = Arrays.asList("averageMachineHourlyCostPBCurrency", "averageLaborHourlyCostPBCurrency", "additionalOverheadPBCurrency");
    for (String currencyFieldName : currencyFieldNames) {
        FieldComponent fieldComponent = (FieldComponent) viewDefinitionState.getComponentByReference(currencyFieldName);
        fieldComponent.setFieldValue(currencyAlphabeticCode);
        fieldComponent.requestComponentUpdateState();
    }
    fillComponentWithPercent("productionCostMarginPBProc", viewDefinitionState);
    fillComponentWithPercent("materialCostMarginPBProc", viewDefinitionState);
    fillComponentWithPercent("registrationPriceOverheadPBProc", viewDefinitionState);
    fillComponentWithPercent("technicalProductionCostOverheadPBProc", viewDefinitionState);
    fillComponentWithPercent("profitPBProc", viewDefinitionState);
}
Also used : FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 43 with FieldComponent

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

the class ProductionBalanceDetailsHooks method fillCurrencyAndUnitFields.

public void fillCurrencyAndUnitFields(final ViewDefinitionState view) {
    String currencyAlphabeticCode = currencyService.getCurrencyAlphabeticCode();
    List<String> currencyFieldNames = Lists.newArrayList("additionalOverheadCurrency");
    for (String currencyFieldName : currencyFieldNames) {
        FieldComponent fieldComponent = (FieldComponent) view.getComponentByReference(currencyFieldName);
        fieldComponent.setFieldValue(currencyAlphabeticCode);
        fieldComponent.requestComponentUpdateState();
    }
    List<String> procFields = Lists.newArrayList("productionCostMarginProc", "materialCostMarginProc", "registrationPriceOverheadProc", "technicalProductionCostOverheadProc", "profitProc");
    for (String field : procFields) {
        FieldComponent materialCostMarginProc = (FieldComponent) view.getComponentByReference(field);
        materialCostMarginProc.setFieldValue("%");
        materialCostMarginProc.requestComponentUpdateState();
    }
}
Also used : FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 44 with FieldComponent

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

the class ProductionTrackingDetailsHooks method setStateFieldValueToDraft.

private void setStateFieldValueToDraft(final ViewDefinitionState view) {
    FieldComponent stateField = (FieldComponent) view.getComponentByReference(L_STATE);
    stateField.setFieldValue(ProductionTrackingState.DRAFT.getStringValue());
    stateField.requestComponentUpdateState();
}
Also used : FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 45 with FieldComponent

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

the class ProductionPerShiftDetailsHooks method fillProgressesUnitFields.

private void fillProgressesUnitFields(final AwesomeDynamicListComponent progressForDaysADL, final Optional<Entity> maybeMainOperationProduct) {
    String unit = FluentOptional.wrap(maybeMainOperationProduct).flatMap(EntityUtils.<String>getSafeFieldExtractor(ProductFields.UNIT)).toOpt().orNull();
    for (FormComponent progressForDayForm : progressForDaysADL.getFormComponents()) {
        AwesomeDynamicListComponent dailyProgressADL = (AwesomeDynamicListComponent) progressForDayForm.findFieldComponentByName(DAILY_PROGRESS_ADL_REF);
        for (FormComponent dailyProgressForm : dailyProgressADL.getFormComponents()) {
            FieldComponent unitField = dailyProgressForm.findFieldComponentByName(UNIT_COMPONENT_NAME);
            unitField.setFieldValue(unit);
            unitField.requestComponentUpdateState();
        }
        dailyProgressADL.requestComponentUpdateState();
    }
    progressForDaysADL.requestComponentUpdateState();
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent) AwesomeDynamicListComponent(com.qcadoo.view.api.components.AwesomeDynamicListComponent)

Aggregations

FieldComponent (com.qcadoo.view.api.components.FieldComponent)443 Entity (com.qcadoo.model.api.Entity)201 FormComponent (com.qcadoo.view.api.components.FormComponent)183 LookupComponent (com.qcadoo.view.api.components.LookupComponent)107 BigDecimal (java.math.BigDecimal)47 CheckBoxComponent (com.qcadoo.view.api.components.CheckBoxComponent)31 GridComponent (com.qcadoo.view.api.components.GridComponent)31 Date (java.util.Date)30 Optional (com.google.common.base.Optional)18 AwesomeDynamicListComponent (com.qcadoo.view.api.components.AwesomeDynamicListComponent)14 ComponentState (com.qcadoo.view.api.ComponentState)13 FilterValueHolder (com.qcadoo.view.api.components.lookup.FilterValueHolder)13 WindowComponent (com.qcadoo.view.api.components.WindowComponent)12 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)11 RibbonGroup (com.qcadoo.view.api.ribbon.RibbonGroup)9 PossibleUnitConversions (com.qcadoo.model.api.units.PossibleUnitConversions)7 SimpleDateFormat (java.text.SimpleDateFormat)7 ViewDefinitionState (com.qcadoo.view.api.ViewDefinitionState)6 QcadooViewConstants (com.qcadoo.view.constants.QcadooViewConstants)6 Collectors (java.util.stream.Collectors)6