use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class ProductionTrackingDetailsHooks method toggleCorrectButton.
private void toggleCorrectButton(final ViewDefinitionState view, final Entity entity) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonActionItem correctButton = window.getRibbon().getGroupByName(L_CORRECTION).getItemByName(L_CORRECT);
String state = entity.getStringField(ProductionTrackingFields.STATE);
Entity order = entity.getBelongsToField(ProductionTrackingFields.ORDER);
String orderState = order.getStringField(OrderFields.STATE);
boolean productionTrackingIsAccepted = ProductionTrackingStateStringValues.ACCEPTED.equals(state);
boolean orderIsNotFinished = !OrderStateStringValues.COMPLETED.equals(orderState) && !OrderStateStringValues.ABANDONED.equals(orderState);
if (productionTrackingIsAccepted && orderIsNotFinished) {
correctButton.setEnabled(true);
} else {
correctButton.setEnabled(false);
}
correctButton.requestUpdate(true);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class ProductionTrackingServiceImpl method setTimeAndPieceworkComponentsVisible.
@Override
public void setTimeAndPieceworkComponentsVisible(final ViewDefinitionState view, final Entity order) {
String recordingType = order.getStringField(OrderFieldsPC.TYPE_OF_PRODUCTION_RECORDING);
boolean recordingTypeEqualsForEach = TypeOfProductionRecording.FOR_EACH.getStringValue().equals(recordingType);
boolean recordingTypeEqualsBasic = TypeOfProductionRecording.BASIC.getStringValue().equals(recordingType);
LookupComponent tocComponent = (LookupComponent) view.getComponentByReference(ProductionTrackingFields.TECHNOLOGY_OPERATION_COMPONENT);
tocComponent.setVisible(recordingTypeEqualsForEach);
tocComponent.setRequired(recordingTypeEqualsForEach);
boolean registerProductionTime = order.getBooleanField(OrderFieldsPC.REGISTER_PRODUCTION_TIME);
view.getComponentByReference(L_TIME_TAB).setVisible(registerProductionTime && !recordingTypeEqualsBasic);
ProductionTrackingState recordState = getTrackingState(view);
final FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
if (form.getEntityId() != null) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonActionItem calcTotalLaborTimeBtn = window.getRibbon().getGroupByName(L_WORK_TIME_RIBBON_GROUP).getItemByName(L_CALC_LABOR_TOTAL_TIME_RIBBON_BUTTON);
calcTotalLaborTimeBtn.setEnabled(registerProductionTime && !recordingTypeEqualsBasic && ProductionTrackingState.DRAFT.equals(recordState));
calcTotalLaborTimeBtn.requestUpdate(true);
}
boolean registerPiecework = order.getBooleanField(OrderFieldsPC.REGISTER_PIECEWORK);
view.getComponentByReference(L_PIECEWORK_TAB).setVisible(registerPiecework && recordingTypeEqualsForEach);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class CompanyDetailsHooksSN method updateRibbonState.
public void updateRibbonState(final ViewDefinitionState view) {
FormComponent companyForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Entity company = companyForm.getEntity();
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup suppliersGroup = (RibbonGroup) window.getRibbon().getGroupByName(L_SUPPLIERS_GROUP);
RibbonActionItem redirectToFilteredOffersList = (RibbonActionItem) suppliersGroup.getItemByName(L_REDIRECT_TO_FILTERED_OFFERS_LIST);
RibbonActionItem redirectToFilteredRequestsList = (RibbonActionItem) suppliersGroup.getItemByName(L_REDIRECT_TO_FILTERED_REQUESTS_LIST);
boolean isEnabled = (company.getId() != null);
updateButtonState(redirectToFilteredOffersList, isEnabled);
updateButtonState(redirectToFilteredRequestsList, isEnabled);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class NegotiationDetailsHooks method updateRibbonState.
public void updateRibbonState(final ViewDefinitionState view) {
FormComponent negotiationForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup requestForQuotations = (RibbonGroup) window.getRibbon().getGroupByName(L_REQUEST_FOR_QUOTATIONS);
RibbonGroup offers = (RibbonGroup) window.getRibbon().getGroupByName(L_OFFERS);
RibbonGroup status = window.getRibbon().getGroupByName(L_STATUS);
RibbonActionItem generate = status.getItemByName(L_GENERATE);
RibbonActionItem cancel = status.getItemByName(L_CANCEL);
RibbonActionItem showRequestForQuotationsForGivenNegotiation = (RibbonActionItem) requestForQuotations.getItemByName(L_SHOW_REQUEST_FOR_QUOTATIONS_FOR_GIVEN_NEGOTIATION);
RibbonActionItem showOffersForGivenNegotiation = (RibbonActionItem) offers.getItemByName(L_SHOW_OFFERS_FOR_GIVEN_NEGOTIATION);
RibbonActionItem showOffersItemsForGivenNegotiation = (RibbonActionItem) offers.getItemByName(L_SHOW_OFFERS_ITEMS_FOR_GIVEN_NEGOTIATION);
boolean isEnabled = ((negotiationForm.getEntityId() != null) && hasNegotiationProducts(negotiationForm.getEntity()));
updateButtonState(generate, isEnabled);
updateButtonState(cancel, isEnabled);
updateButtonState(showRequestForQuotationsForGivenNegotiation, isEnabled);
updateButtonState(showOffersForGivenNegotiation, isEnabled);
updateButtonState(showOffersItemsForGivenNegotiation, isEnabled);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class TechnologyDetailsListeners method generateProductStructure.
public void generateProductStructure(final ViewDefinitionState view, final ComponentState state, final String[] args) {
FormComponent technologyForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
FormComponent productStructureForm = (FormComponent) view.getComponentByReference(L_PRODUCT_STRUCTURE_FORM);
Entity technology = technologyForm.getEntity();
Entity productTechnology = technology.copy();
EntityTree generatedTree = productStructureTreeService.generateProductStructureTree(view, technology);
productTechnology.setField(PRODUCT_STRUCTURE_TREE, generatedTree);
productStructureForm.setEntity(productTechnology);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
window.setActiveTab(L_PRODUCT_STRUCTURE);
}
Aggregations