use of com.qcadoo.view.api.components.TreeComponent in project mes by qcadoo.
the class TechnologyDetailsListeners method removeOnlySelectedOperation.
public void removeOnlySelectedOperation(final ViewDefinitionState view, final ComponentState state, final String[] args) {
final TreeComponent technologyTree = (TreeComponent) view.getComponentByReference(L_TECHNOLOGY_TREE_REFERENCE);
final Long selectedEntityId = technologyTree.getSelectedEntityId();
Entity selectedOperation = getTechnologyOperationComponentDD().get(selectedEntityId);
boolean removed = removeTOCService.removeOnlySelectedOperation(selectedOperation, view);
if (removed) {
FormComponent technologyForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
technologyForm.performEvent(view, "reset");
view.addMessage("technologies.technologyDetails.window.treeTab.technologyTree.success", ComponentState.MessageType.SUCCESS);
}
}
use of com.qcadoo.view.api.components.TreeComponent in project mes by qcadoo.
the class GeneratorView method from.
public static GeneratorView from(final ViewDefinitionState view) {
FormComponent form = view.<FormComponent>tryFindComponentByReference(QcadooViewConstants.L_FORM).orNull();
Preconditions.checkArgument(form != null, "Cannot find form component!");
LookupComponent technologyLookup = view.<LookupComponent>tryFindComponentByReference("technology").orNull();
Preconditions.checkArgument(technologyLookup != null, "Cannot find technology lookup component!");
TreeComponent treeComponent = (TreeComponent) view.getComponentByReference("technologiesTree");
Preconditions.checkArgument(treeComponent != null, "Cannot find technologies tree component!");
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Preconditions.checkArgument(window != null, "Cannot find window component!");
return new GeneratorView(view, window, form, technologyLookup, treeComponent);
}
use of com.qcadoo.view.api.components.TreeComponent in project mes by qcadoo.
the class TechnologyDetailsHooks method setTreeTabEditable.
public void setTreeTabEditable(final ViewDefinitionState view) {
final boolean treeTabShouldBeEnabled = !isTemplateAccepted(view) && TechnologyState.DRAFT.equals(getTechnologyState(view)) && technologyIsAlreadySaved(view);
ComponentState technologyTree = view.getComponentByReference(TECHNOLOGY_TREE_REFERENCE);
technologyTree.setEnabled(treeTabShouldBeEnabled);
Long selectedEntity = ((TreeComponent) technologyTree).getSelectedEntityId();
for (String componentReference : Sets.newHashSet(OUT_PRODUCTS_REFERENCE, IN_PRODUCTS_REFERENCE)) {
GridComponent grid = (GridComponent) view.getComponentByReference(componentReference);
grid.setEnabled(treeTabShouldBeEnabled && Objects.nonNull(selectedEntity));
}
}
use of com.qcadoo.view.api.components.TreeComponent in project mes by qcadoo.
the class TechnologyDetailsHooks method navigateToActiveTab.
// TODO hotfix for issue-1901 with restoring previous active tab state after back operation, requires fixes in framework
public void navigateToActiveTab(final ViewDefinitionState view) {
TreeComponent technologyTree = (TreeComponent) view.getComponentByReference(TECHNOLOGY_TREE_REFERENCE);
Long selectedEntity = technologyTree.getSelectedEntityId();
if (Objects.nonNull(selectedEntity)) {
((WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW)).setActiveTab(L_TREE_TAB);
}
}
Aggregations