Search in sources :

Example 1 with FenceAgentModel

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

the class FenceAgentWidget method showConcurrentGroup.

private void showConcurrentGroup(FenceAgentModel model) {
    editFenceAgent.setVisible(false);
    FenceAgentConcurrentWidget concurrentWidget = new FenceAgentConcurrentWidget();
    concurrentWidget.addRemoveConcurrentGroupClickHandler(removeConcurrentGroupClickHandlerMap.get(model));
    concurrentWidget.edit(model);
    concurrentPanel.add(concurrentWidget);
    for (FenceAgentModel concurrentModel : model.getConcurrentList()) {
        concurrentWidget = new FenceAgentConcurrentWidget();
        concurrentWidget.addRemoveConcurrentGroupClickHandler(removeConcurrentGroupClickHandlerMap.get(concurrentModel));
        concurrentWidget.edit(concurrentModel);
        concurrentPanel.add(concurrentWidget);
    }
}
Also used : FenceAgentModel(org.ovirt.engine.ui.uicommonweb.models.hosts.FenceAgentModel)

Example 2 with FenceAgentModel

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

the class FenceAgentsEditor method createWidget.

@Override
protected FenceAgentWidget createWidget(final FenceAgentModel model) {
    modelProvider.initializeModel(model);
    FenceAgentWidget widget = new FenceAgentWidget();
    widget.addUpClickHandler(event -> {
        listModel.moveUp(model);
        updateButtonState();
    });
    widget.addDownClickHandler(event -> {
        listModel.moveDown(model);
        updateButtonState();
    });
    widget.addRemoveConcurrentGroupClickHandler(model, event -> {
        listModel.removeConcurrent(model);
        listModel.updateConcurrentList();
    });
    for (final FenceAgentModel concurrentModel : model.getConcurrentList()) {
        modelProvider.initializeModel(concurrentModel);
        widget.addRemoveConcurrentGroupClickHandler(concurrentModel, event -> {
            listModel.removeConcurrent(concurrentModel);
            listModel.updateConcurrentList();
        });
    }
    widget.edit(model);
    model.getManagementIp().getEntityChangedEvent().addListener((ev, sender, args) -> {
        listModel.updateConcurrentList();
        for (Pair<FenceAgentModel, FenceAgentWidget> modelWidgetPair : items) {
            modelWidgetPair.getSecond().refresh();
        }
    });
    model.getConcurrentSelectList().getSelectedItemChangedEvent().addListener((ev, sender, args) -> {
        if (sender instanceof ListModel) {
            @SuppressWarnings("unchecked") ListModel<String> sourceListModel = (ListModel<String>) sender;
            if (sourceListModel.getItems() != null && !sourceListModel.getItems().isEmpty() && sourceListModel.getItems() instanceof List) {
                List<String> options = (List<String>) sourceListModel.getItems();
                if (!options.get(0).equals(sourceListModel.getSelectedItem())) {
                    // Another option selected.
                    listModel.makeConcurrent(model, sourceListModel.getSelectedItem());
                }
            }
        }
    });
    return widget;
}
Also used : ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) FenceAgentListModel(org.ovirt.engine.ui.uicommonweb.models.hosts.FenceAgentListModel) FenceAgentModel(org.ovirt.engine.ui.uicommonweb.models.hosts.FenceAgentModel) List(java.util.List)

Example 3 with FenceAgentModel

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

the class FenceAgentsEditor method createGhostValue.

@Override
protected FenceAgentModel createGhostValue() {
    final FenceAgentModel ghostModel = new FenceAgentModel();
    ghostModel.getPmType().setItems(listModel.getPmTypes());
    ghostModel.setHost(listModel.getHostModel());
    ghostModel.setOrder(listModel.getItems().size() + 1);
    return ghostModel;
}
Also used : FenceAgentModel(org.ovirt.engine.ui.uicommonweb.models.hosts.FenceAgentModel)

Aggregations

FenceAgentModel (org.ovirt.engine.ui.uicommonweb.models.hosts.FenceAgentModel)3 List (java.util.List)1 ListModel (org.ovirt.engine.ui.uicommonweb.models.ListModel)1 FenceAgentListModel (org.ovirt.engine.ui.uicommonweb.models.hosts.FenceAgentListModel)1