Search in sources :

Example 1 with EnablerPredicateFactory

use of org.whole.lang.ui.actions.EnablerPredicateFactory in project whole by wholeplatform.

the class CommandFactory method addOverCompositeConstraints.

protected synchronized void addOverCompositeConstraints(final Object[][] dndRules) {
    EnablerPredicateFactory pf = getEnablerPredicateFactory();
    List<IPartRequestHandler> addList = new ArrayList<IPartRequestHandler>(dndRules.length * 3);
    List<IPartRequestHandler> cloneList = new ArrayList<IPartRequestHandler>(dndRules.length * 3);
    List<IPartRequestHandler> shareList = new ArrayList<IPartRequestHandler>(dndRules.length * 3);
    for (Object[] dndRule : dndRules) {
        EntityDescriptor<?> dndED = (EntityDescriptor<?>) dndRule[0];
        EntityDescriptor<?> targetED = (EntityDescriptor<?>) dndRule[1];
        IFeatureTransformer featureTransformer = (IFeatureTransformer) dndRule[2];
        boolean isExecutable = (Boolean) dndRule[3];
        addList.add(new PartRequestHandler(pf.dndSingleOverResolverIn(dndED, targetED), isExecutable ? new ReplaceChildCommandFactory(featureTransformer) : unexecutableFeature));
        cloneList.add(new PartRequestHandler(pf.dndSingleOverResolverIn(dndED, targetED), isExecutable ? new ReplaceChildCommandFactory(CLONE(featureTransformer)) : unexecutableFeature));
        shareList.add(new PartRequestHandler(pf.dndSingleOverResolverIn(dndED, targetED), isExecutable ? new ReplaceChildCommandFactory(SHARE(featureTransformer)) : unexecutableFeature));
        addList.add(new PartRequestHandler(pf.dndOverResolverIn(dndED, targetED), isExecutable ? new CompoundReplaceChildCommandFactory(featureTransformer) : unexecutableFeature));
        cloneList.add(new PartRequestHandler(pf.dndOverResolverIn(dndED, targetED), isExecutable ? new CompoundReplaceChildCommandFactory(CLONE(featureTransformer)) : unexecutableFeature));
        shareList.add(new PartRequestHandler(pf.dndOverResolverIn(dndED, targetED), isExecutable ? new CompoundReplaceChildCommandFactory(SHARE(featureTransformer)) : unexecutableFeature));
        addList.add(new PartRequestHandler(pf.dndOver(dndED, targetED), isExecutable ? new CompositeAddCommandFactory(featureTransformer) : unexecutableFeature));
        cloneList.add(new PartRequestHandler(pf.dndOver(dndED, targetED), isExecutable ? new CompositeAddCommandFactory(CLONE(featureTransformer)) : unexecutableFeature));
        shareList.add(new PartRequestHandler(pf.dndOver(dndED, targetED), isExecutable ? new CompositeAddCommandFactory(SHARE(featureTransformer)) : unexecutableFeature));
    }
    addHandlers(PartRequest.MOVE_ADD_CHILD, addList);
    addHandlers(PartRequest.CLONE_CHILD, cloneList);
    addHandlers(PartRequest.SHARE_CHILD, shareList);
}
Also used : EnablerPredicateFactory(org.whole.lang.ui.actions.EnablerPredicateFactory) ArrayList(java.util.ArrayList) EntityDescriptor(org.whole.lang.reflect.EntityDescriptor)

Example 2 with EnablerPredicateFactory

use of org.whole.lang.ui.actions.EnablerPredicateFactory in project whole by wholeplatform.

the class CommandFactory method addOverSimpleConstraints.

protected synchronized void addOverSimpleConstraints(final Object[][] dndRules) {
    EnablerPredicateFactory pf = getEnablerPredicateFactory();
    List<IPartRequestHandler> cloneList = new ArrayList<IPartRequestHandler>(dndRules.length);
    List<IPartRequestHandler> shareList = new ArrayList<IPartRequestHandler>(dndRules.length);
    for (Object[] dndRule : dndRules) {
        EntityDescriptor<?> dndED = (EntityDescriptor<?>) dndRule[0];
        EntityDescriptor<?> targetED = (EntityDescriptor<?>) dndRule[1];
        IFeatureTransformer featureTransformer = (IFeatureTransformer) dndRule[2];
        boolean isExecutable = (Boolean) dndRule[3];
        cloneList.add(new PartRequestHandler(pf.dndSingleOver(dndED, targetED), isExecutable ? new ReplaceChildCommandFactory(CLONE(featureTransformer)) : unexecutableFeature));
        shareList.add(new PartRequestHandler(pf.dndSingleOver(dndED, targetED), isExecutable ? new ReplaceChildCommandFactory(SHARE(featureTransformer)) : unexecutableFeature));
    }
    addHandlers(PartRequest.CLONE_CHILD, cloneList);
    addHandlers(PartRequest.SHARE_CHILD, shareList);
}
Also used : EnablerPredicateFactory(org.whole.lang.ui.actions.EnablerPredicateFactory) ArrayList(java.util.ArrayList) EntityDescriptor(org.whole.lang.reflect.EntityDescriptor)

Aggregations

ArrayList (java.util.ArrayList)2 EntityDescriptor (org.whole.lang.reflect.EntityDescriptor)2 EnablerPredicateFactory (org.whole.lang.ui.actions.EnablerPredicateFactory)2