use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class OperationDetailsHooks method clearLookupField.
public void clearLookupField(final ViewDefinitionState view, String fieldName) {
LookupComponent lookupComponent = (LookupComponent) view.getComponentByReference(fieldName);
lookupComponent.setFieldValue(null);
lookupComponent.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class OperationSkillDetailsHooks method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
FormComponent operationSkillForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
LookupComponent skillLookup = (LookupComponent) view.getComponentByReference(OperationSkillFields.SKILL);
Entity operationSkill = operationSkillForm.getEntity();
Entity operation = operationSkill.getBelongsToField(OperationSkillFields.OPERATION);
filterSkillLookup(skillLookup, operation);
fillMaxSkill(view, skillLookup);
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class TechnologyDetailsHooks method disableFieldTechnologyFormAndEnabledMaster.
public void disableFieldTechnologyFormAndEnabledMaster(final ViewDefinitionState view) {
FormComponent technologyForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
FieldComponent masterField = (FieldComponent) view.getComponentByReference(TechnologyFields.MASTER);
LookupComponent technologyGroupLookup = (LookupComponent) view.getComponentByReference(TechnologyFields.TECHNOLOGY_GROUP);
boolean disabled = false;
boolean masterDisabled = false;
boolean technologyGroupEnabled = false;
Long technologyId = technologyForm.getEntityId();
if (Objects.nonNull(technologyId)) {
Entity technology = getTechnologyDD().get(technologyId);
if (Objects.isNull(technology)) {
return;
}
String state = technology.getStringField(TechnologyFields.STATE);
boolean isTemplateAccepted = technology.getBooleanField(TechnologyFields.IS_TEMPLATE_ACCEPTED);
if (isTemplateAccepted || !TechnologyState.DRAFT.getStringValue().equals(state)) {
disabled = true;
}
if (TechnologyState.ACCEPTED.getStringValue().equals(state)) {
masterDisabled = true;
}
if (TechnologyState.ACCEPTED.getStringValue().equals(state) || TechnologyState.CHECKED.getStringValue().equals(state) || TechnologyState.DRAFT.getStringValue().equals(state)) {
technologyGroupEnabled = true;
}
}
technologyForm.setFormEnabled(!disabled);
masterField.setEnabled(masterDisabled);
masterField.requestComponentUpdateState();
technologyGroupLookup.setEnabled(technologyGroupEnabled);
technologyGroupLookup.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class TechnologyReferenceTechnologyComponentDetailsHooks method disabledSaveBackButton.
public void disabledSaveBackButton(final ViewDefinitionState viewDefinitionState) {
WindowComponent window = (WindowComponent) viewDefinitionState.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup actionsGroup = (RibbonGroup) window.getRibbon().getGroupByName("actions");
RibbonActionItem saveBack = (RibbonActionItem) actionsGroup.getItemByName("saveBack");
LookupComponent technology = (LookupComponent) viewDefinitionState.getComponentByReference("technology");
if (technology.getEntity() == null) {
saveBack.setEnabled(false);
} else {
saveBack.setEnabled(true);
}
saveBack.requestUpdate(true);
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class SkillOperationDetailsHooks method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Entity opSkill = form.getEntity();
FieldComponent maxSkillLevelField = (FieldComponent) view.getComponentByReference(MAX_LEVEL);
maxSkillLevelField.setFieldValue(opSkill.getBelongsToField(OperationSkillFields.SKILL).getIntegerField(SkillFields.MAXIMUM_LEVEL));
LookupComponent operationLookup = (LookupComponent) view.getComponentByReference(OperationSkillFields.OPERATION);
FilterValueHolder filterValueHolder = operationLookup.getFilterValue();
Long skillId = opSkill.getBelongsToField(StaffSkillsFields.SKILL).getId();
if (Objects.isNull(skillId)) {
filterValueHolder.remove(L_SKILL_ID);
} else {
filterValueHolder.put(L_SKILL_ID, skillId);
}
operationLookup.setFilterValue(filterValueHolder);
}
Aggregations