Search in sources :

Example 1 with IBeanRelationNodeModel

use of org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModel in project jo-client-platform by jo-source.

the class BeanRelationTreeModelImpl method clear.

@Override
public void clear() {
    root.clear();
    for (final Object relationModelObject : relationNodes.values()) {
        final IBeanRelationNodeModel<?, ?> relationModel = (IBeanRelationNodeModel<?, ?>) relationModelObject;
        relationModel.dispose();
    }
    for (final IDataModel dataModel : externalDataModels) {
        dataModel.clear();
    }
    relationNodes.clear();
    if (selection != null && !selection.getSelection().isEmpty()) {
        setSelection(null);
    }
}
Also used : IBeanRelationNodeModel(org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModel) IDataModel(org.jowidgets.cap.ui.api.model.IDataModel)

Example 2 with IBeanRelationNodeModel

use of org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModel in project jo-client-platform by jo-source.

the class BeanRelationTreeModelImpl method getNode.

@Override
public <METHOD_PARENT_BEAN_TYPE, METHOD_CHILD_BEAN_TYPE> IBeanRelationNodeModel<METHOD_PARENT_BEAN_TYPE, METHOD_CHILD_BEAN_TYPE> getNode(final IEntityTypeId<METHOD_PARENT_BEAN_TYPE> parentEntityTypeId, final IBeanProxy<METHOD_PARENT_BEAN_TYPE> parentBean, final IEntityTypeId<METHOD_CHILD_BEAN_TYPE> childEntityTypeId) {
    final Tuple<IBeanProxy<METHOD_PARENT_BEAN_TYPE>, IEntityTypeId<METHOD_CHILD_BEAN_TYPE>> key;
    key = new Tuple<IBeanProxy<METHOD_PARENT_BEAN_TYPE>, IEntityTypeId<METHOD_CHILD_BEAN_TYPE>>(parentBean, childEntityTypeId);
    Object result = relationNodes.get(key);
    if (result == null) {
        final BeanRelationNodeModelBuilder<METHOD_PARENT_BEAN_TYPE, METHOD_CHILD_BEAN_TYPE, IBeanRelationNodeModelBluePrint<?, ?>> builder;
        builder = new BeanRelationNodeModelBuilder<METHOD_PARENT_BEAN_TYPE, METHOD_CHILD_BEAN_TYPE, IBeanRelationNodeModelBluePrint<?, ?>>(parentEntityTypeId, parentBean, childEntityTypeId);
        builder.setBeanProxyContext(beanProxyContext);
        nodeConfigurator.configureNode(childEntityTypeId, builder);
        final IBeanRelationNodeModel nodeModel = builder.build();
        registerListeners(nodeModel);
        result = nodeModel;
        relationNodes.put(key, result);
    }
    return (IBeanRelationNodeModel<METHOD_PARENT_BEAN_TYPE, METHOD_CHILD_BEAN_TYPE>) result;
}
Also used : IBeanRelationNodeModelBluePrint(org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModelBluePrint) IBeanRelationNodeModel(org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModel) IEntityTypeId(org.jowidgets.cap.ui.api.types.IEntityTypeId) IBeanProxy(org.jowidgets.cap.ui.api.bean.IBeanProxy)

Example 3 with IBeanRelationNodeModel

use of org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModel in project jo-client-platform by jo-source.

the class BeanRelationGraphImpl method loadChildren.

@SuppressWarnings("unused")
private List<IBeanRelationNodeModel<Object, Object>> loadChildren(final IBeanRelationNodeModel<?, Object> beanRelationNodeModel) {
    final List<IBeanRelationNodeModel<Object, Object>> childList = new LinkedList<IBeanRelationNodeModel<Object, Object>>();
    for (final IEntityTypeId<Object> entityType : beanRelationNodeModel.getChildRelations()) {
        final int childRelations = beanRelationNodeModel.getSize();
        for (int i = 0; i < childRelations; i++) {
            final IBeanRelationNodeModel<Object, Object> childRelationModel = relationTreeModel.getNode(beanRelationNodeModel.getChildEntityTypeId(), beanRelationNodeModel.getBean(i), entityType);
            if (!childRelationModel.loadIfNotYetDone() && graph.getNodeCount() <= maxNodeCount) {
                if (!beanRelationMap.containsValue(childRelationModel)) {
                    onBeansChanged(childRelationModel);
                }
            }
            childList.add(childRelationModel);
        }
    }
    return childList;
}
Also used : IBeanRelationNodeModel(org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModel) LinkedList(java.util.LinkedList) IInputFieldBluePrint(org.jowidgets.api.widgets.blueprint.IInputFieldBluePrint) IComboBoxSelectionBluePrint(org.jowidgets.api.widgets.blueprint.IComboBoxSelectionBluePrint) Point(java.awt.Point)

Example 4 with IBeanRelationNodeModel

use of org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModel in project jo-client-platform by jo-source.

the class BeanRelationTreeModelImpl method cancelExecutions.

@Override
public void cancelExecutions() {
    root.cancelExecutions();
    for (final Object relationModelObject : relationNodes.values()) {
        final IBeanRelationNodeModel<?, ?> relationModel = (IBeanRelationNodeModel<?, ?>) relationModelObject;
        relationModel.cancelExecutions();
    }
    for (final IDataModel dataModel : externalDataModels) {
        dataModel.cancelExecutions();
    }
}
Also used : IBeanRelationNodeModel(org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModel) IDataModel(org.jowidgets.cap.ui.api.model.IDataModel)

Example 5 with IBeanRelationNodeModel

use of org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModel in project jo-client-platform by jo-source.

the class BeanRelationTreeModelImpl method createValidationResult.

@Override
public IValidationResult createValidationResult() {
    final IValidationResultBuilder builder = ValidationResult.builder();
    builder.addResult(root.validate());
    for (final Object relationModelObject : relationNodes.values()) {
        final IBeanRelationNodeModel<?, ?> relationModel = (IBeanRelationNodeModel<?, ?>) relationModelObject;
        builder.addResult(relationModel.validate());
    }
    for (final IDataModel dataModel : externalDataModels) {
        builder.addResult(dataModel.validate());
    }
    return builder.build();
}
Also used : IBeanRelationNodeModel(org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModel) IValidationResultBuilder(org.jowidgets.validation.IValidationResultBuilder) IDataModel(org.jowidgets.cap.ui.api.model.IDataModel)

Aggregations

IBeanRelationNodeModel (org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModel)7 IBeanProxy (org.jowidgets.cap.ui.api.bean.IBeanProxy)3 IDataModel (org.jowidgets.cap.ui.api.model.IDataModel)3 ITreeNode (org.jowidgets.api.widgets.ITreeNode)2 Point (java.awt.Point)1 LinkedList (java.util.LinkedList)1 IDisposeListener (org.jowidgets.api.controller.IDisposeListener)1 ITreeContainer (org.jowidgets.api.widgets.ITreeContainer)1 IComboBoxSelectionBluePrint (org.jowidgets.api.widgets.blueprint.IComboBoxSelectionBluePrint)1 IInputFieldBluePrint (org.jowidgets.api.widgets.blueprint.IInputFieldBluePrint)1 IBeanRelationNodeModelBluePrint (org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModelBluePrint)1 IEntityTypeId (org.jowidgets.cap.ui.api.types.IEntityTypeId)1 IBeanRelationTreeBluePrint (org.jowidgets.cap.ui.api.widgets.IBeanRelationTreeBluePrint)1 MenuModelKeyBinding (org.jowidgets.tools.model.item.MenuModelKeyBinding)1 IValidationResultBuilder (org.jowidgets.validation.IValidationResultBuilder)1