Search in sources :

Example 1 with OperationCandidateEventArgs

use of org.ovirt.engine.ui.uicommonweb.models.hosts.network.OperationCandidateEventArgs in project ovirt-engine by oVirt.

the class HostSetupNetworksModel method candidateOperation.

public boolean candidateOperation(String op1Key, String op1Type, String op2Key, String op2Type, boolean drop) {
    NetworkItemModel<?> op1 = getItemModel(op1Key, op1Type);
    NetworkItemModel<?> op2 = getItemModel(op2Key, op2Type);
    if (op1 == null) {
        // $NON-NLS-1$
        throw new IllegalArgumentException("null Operands");
    }
    NetworkOperation candidate = NetworkOperationFactory.operationFor(op1, op2, true);
    if (drop) {
        onOperation(candidate, candidate.getCommand(op1, op2, hostSetupNetworksParametersData));
    }
    // raise the candidate event only if it was changed
    if (!candidate.equals(currentCandidate) || !equals(op1, currentOp1) || !equals(op2, currentOp2)) {
        currentCandidate = candidate;
        currentOp1 = op1;
        currentOp2 = op2;
        getOperationCandidateEvent().raise(this, new OperationCandidateEventArgs(candidate, op1, op2));
    }
    return !candidate.isNullOperation();
}
Also used : OperationCandidateEventArgs(org.ovirt.engine.ui.uicommonweb.models.hosts.network.OperationCandidateEventArgs) NetworkOperation(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkOperation)

Aggregations

NetworkOperation (org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkOperation)1 OperationCandidateEventArgs (org.ovirt.engine.ui.uicommonweb.models.hosts.network.OperationCandidateEventArgs)1