Search in sources :

Example 1 with TreeComponent

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);
    }
}
Also used : TreeComponent(com.qcadoo.view.api.components.TreeComponent) Entity(com.qcadoo.model.api.Entity) FormComponent(com.qcadoo.view.api.components.FormComponent)

Example 2 with TreeComponent

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);
}
Also used : TreeComponent(com.qcadoo.view.api.components.TreeComponent) FormComponent(com.qcadoo.view.api.components.FormComponent) LookupComponent(com.qcadoo.view.api.components.LookupComponent) WindowComponent(com.qcadoo.view.api.components.WindowComponent)

Example 3 with 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));
    }
}
Also used : TreeComponent(com.qcadoo.view.api.components.TreeComponent) GridComponent(com.qcadoo.view.api.components.GridComponent) ComponentState(com.qcadoo.view.api.ComponentState)

Example 4 with TreeComponent

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);
    }
}
Also used : TreeComponent(com.qcadoo.view.api.components.TreeComponent) WindowComponent(com.qcadoo.view.api.components.WindowComponent)

Aggregations

TreeComponent (com.qcadoo.view.api.components.TreeComponent)4 FormComponent (com.qcadoo.view.api.components.FormComponent)2 WindowComponent (com.qcadoo.view.api.components.WindowComponent)2 Entity (com.qcadoo.model.api.Entity)1 ComponentState (com.qcadoo.view.api.ComponentState)1 GridComponent (com.qcadoo.view.api.components.GridComponent)1 LookupComponent (com.qcadoo.view.api.components.LookupComponent)1