use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class ClusterGeneralModel method detachNewGlusterHosts.
public void detachNewGlusterHosts() {
if (getWindow() != null) {
return;
}
final DetachGlusterHostsModel hostsModel = new DetachGlusterHostsModel();
setWindow(hostsModel);
hostsModel.setTitle(ConstantsManager.getInstance().getConstants().detachGlusterHostsTitle());
hostsModel.setHelpTag(HelpTag.detach_gluster_hosts);
// $NON-NLS-1$
hostsModel.setHashName("detach_gluster_hosts");
// $NON-NLS-1$
UICommand command = UICommand.createOkUiCommand("OnDetachGlusterHosts", this);
hostsModel.getCommands().add(command);
hostsModel.getHosts().setItems(new ArrayList<EntityModel<String>>());
// $NON-NLS-1$
hostsModel.getCommands().add(UICommand.createCancelUiCommand("Cancel", this));
hostsModel.startProgress();
AsyncDataProvider.getInstance().getGlusterHostsNewlyAdded(new AsyncQuery<>(hostMap -> {
if (hostMap == null || hostMap.isEmpty()) {
hostsModel.setMessage(ConstantsManager.getInstance().getConstants().emptyNewGlusterHosts());
} else {
ArrayList<EntityModel<String>> hostList = new ArrayList<>();
for (String host : hostMap.keySet()) {
hostList.add(new EntityModel<>(host));
}
hostsModel.getHosts().setItems(hostList);
}
hostsModel.stopProgress();
}), getEntity().getId(), true);
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class HostMaintenanceConfirmationPopupView method edit.
@Override
public void edit(HostMaintenanceConfirmationModel object) {
driver.edit(object);
// Bind "Latch.IsAvailable"
object.getLatch().getPropertyChangedEvent().addListener((ev, sender, args) -> {
if ("IsAvailable".equals(args.propertyName)) {
// $NON-NLS-1$
EntityModel entity = (EntityModel) sender;
if (entity.getIsAvailable()) {
latch.setVisible(true);
}
}
});
if (object.getForceLabel() != null) {
force.setLabel(object.getForceLabel());
}
force.asCheckBox().setValue(object.getForce().getEntity());
// Bind "Force.Label"
object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
if ("ForceLabel".equals(args.propertyName)) {
// $NON-NLS-1$
ConfirmationModel entity = (ConfirmationModel) sender;
force.setLabel(entity.getForceLabel());
}
});
setNote(object.getNote());
// Bind "Note"
object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
if ("Note".equals(args.propertyName)) {
// $NON-NLS-1$
ConfirmationModel entity = (ConfirmationModel) sender;
setNote(entity.getNote());
}
});
// Bind "ReasonVisible"
object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
if ("ReasonVisible".equals(args.propertyName)) {
// $NON-NLS-1$
updateReasonVisibility((HostMaintenanceConfirmationModel) sender);
}
});
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class RemoveConfirmationPopupView method edit.
@Override
public void edit(ConfirmationModel object) {
driver.edit(object);
// Bind "Latch.IsAvailable"
object.getLatch().getPropertyChangedEvent().addListener((ev, sender, args) -> {
if ("IsAvailable".equals(args.propertyName)) {
// $NON-NLS-1$
EntityModel<?> entity = (EntityModel<?>) sender;
if (entity.getIsAvailable()) {
latch.setVisible(true);
}
}
});
if (object.getForceLabel() != null) {
force.setLabel(object.getForceLabel());
}
force.asCheckBox().setValue(object.getForce().getEntity());
// Bind "Force.Label"
object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
if ("ForceLabel".equals(args.propertyName)) {
// $NON-NLS-1$
ConfirmationModel entity = (ConfirmationModel) sender;
force.setLabel(entity.getForceLabel());
}
});
setNote(object.getNote());
// Bind "Note"
object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
if ("Note".equals(args.propertyName)) {
// $NON-NLS-1$
ConfirmationModel entity = (ConfirmationModel) sender;
setNote(entity.getNote());
}
});
// Bind "ReasonVisible"
object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
if ("ReasonVisible".equals(args.propertyName)) {
// $NON-NLS-1$
updateReasonVisibility((ConfirmationModel) sender);
}
});
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class VmListModel method onRemove.
private void onRemove() {
final ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
final ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Entry<Guid, EntityModel> entry : vmsRemoveMap.entrySet()) {
list.add(new RemoveVmParameters(entry.getKey(), false, (Boolean) entry.getValue().getEntity()));
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.RemoveVm, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class VolumeListModel method onCreateVolume.
private void onCreateVolume() {
VolumeModel volumeModel = (VolumeModel) getWindow();
if (!volumeModel.validate()) {
return;
}
Guid clusterId = volumeModel.getCluster().getSelectedItem().getId();
final GlusterVolumeEntity volume = new GlusterVolumeEntity();
volume.setClusterId(clusterId);
volume.setName(volumeModel.getName().getEntity());
GlusterVolumeType type = volumeModel.getTypeList().getSelectedItem();
if (type.isStripedType()) {
volume.setStripeCount(volumeModel.getStripeCountValue());
}
if (type.isReplicatedType()) {
volume.setReplicaCount(volumeModel.getReplicaCountValue());
volume.setIsArbiter(volumeModel.getArbiterVolume().getEntity());
}
volume.setVolumeType(type);
if (volumeModel.getTcpTransportType().getEntity()) {
volume.getTransportTypes().add(TransportType.TCP);
}
if (volumeModel.getRdmaTransportType().getEntity()) {
volume.getTransportTypes().add(TransportType.RDMA);
}
ArrayList<GlusterBrickEntity> brickList = new ArrayList<>();
for (Object model : volumeModel.getBricks().getItems()) {
brickList.add((GlusterBrickEntity) ((EntityModel) model).getEntity());
}
volume.setBricks(brickList);
if (volumeModel.getNfs_accecssProtocol().getEntity()) {
volume.enableNFS();
} else {
volume.disableNFS();
}
if (volumeModel.getCifs_accecssProtocol().getEntity()) {
volume.enableCifs();
} else {
volume.disableCifs();
}
volume.setAccessControlList(volumeModel.getAllowAccess().getEntity());
volumeModel.startProgress();
CreateGlusterVolumeParameters parameter = new CreateGlusterVolumeParameters(volume, volumeModel.isForceAddBricks());
Frontend.getInstance().runAction(ActionType.CreateGlusterVolume, parameter, result -> {
VolumeListModel localModel = (VolumeListModel) result.getState();
localModel.postOnCreateVolume(result.getReturnValue(), volume);
}, this);
}
Aggregations