use of org.ovirt.engine.ui.uicommonweb.models.ConsoleProtocol in project ovirt-engine by oVirt.
the class ConsolePopupPresenterWidget method initView.
private void initView(ConsolePopupModel model) {
listenOnRadioButtons();
VmConsoles vmConsoles = model.getVmConsoles();
getView().setSpiceAvailable(vmConsoles.canSelectProtocol(ConsoleProtocol.SPICE));
getView().setVncAvailable(vmConsoles.canSelectProtocol(ConsoleProtocol.VNC));
getView().setRdpAvailable(vmConsoles.canSelectProtocol(ConsoleProtocol.RDP));
ConsoleProtocol selectedProtocol = vmConsoles.getSelectedProcotol();
boolean rdpPreselected = ConsoleProtocol.RDP.equals(selectedProtocol);
boolean spicePreselected = ConsoleProtocol.SPICE.equals(selectedProtocol);
boolean vncPreselected = ConsoleProtocol.VNC.equals(selectedProtocol);
getView().selectSpice(spicePreselected);
getView().selectRdp(rdpPreselected);
getView().selectVnc(vncPreselected);
getView().showSpicePanel(spicePreselected);
getView().showRdpPanel(rdpPreselected);
getView().showVncPanel(vncPreselected);
getView().setDisableSmartcardVisible(model.getVmConsoles().getVm().isSmartcardEnabled());
ConsoleClient spice = model.getVmConsoles().getConsoleModel(SpiceConsoleModel.class).getSpiceImpl();
if (spice != null) {
if (!spice.getOptions().isWanOptionsEnabled()) {
getView().selectWanOptionsEnabled(false);
}
spiceProxyUserPreference = vmConsoles.getConsoleModel(SpiceConsoleModel.class).getSpiceImpl().getOptions().isSpiceProxyEnabled();
}
getView().setNoVncEnabled(consoleUtils.webBasedClientsSupported(), constants.webBasedClientsUnsupported());
if (!consoleUtils.isBrowserPluginSupported(ConsoleProtocol.RDP)) {
getView().setRdpPluginImplEnabled(false, constants.rdpPluginNotSupportedByBrowser());
}
spiceProxyDefinedOnCluster = consoleUtils.isSpiceProxyDefined(vmConsoles.getVm());
handleSpiceProxyAvailability();
getView().selectVncImplementation(vmConsoles.getConsoleModel(VncConsoleModel.class).getClientConsoleMode());
getView().selectRdpImplementation(vmConsoles.getConsoleModel(RdpConsoleModel.class).getClientConsoleMode());
wanOptionsAvailable = vmConsoles.getConsoleModel(SpiceConsoleModel.class).isWanOptionsAvailableForMyVm();
if (wanOptionsAvailable) {
getView().setWanOptionsVisible(true);
} else {
getView().setWanOptionsVisible(false);
}
getView().setAdditionalConsoleAvailable(vmConsoles.canSelectProtocol(ConsoleProtocol.RDP));
getView().setSpiceConsoleAvailable(vmConsoles.canSelectProtocol(ConsoleProtocol.SPICE));
registerHandler(getView().getConsoleClientResourcesAnchor().addClickHandler(event -> {
// $NON-NLS-1$ $NON-NLS-2$
Window.open(dynamicMessages.consoleClientResourcesUrl(), "_blank", "resizable=yes,scrollbars=yes");
}));
registerHandler(getView().getSpiceProxyEnabledCheckBox().addValueChangeHandler(booleanValueChangeEvent -> spiceProxyUserPreference = booleanValueChangeEvent.getValue()));
final boolean enableUsbAutoshareEnabled = model.getVmConsoles().getVm().getUsbPolicy() == UsbPolicy.ENABLED_NATIVE;
if (enableUsbAutoshareEnabled) {
getView().getEnableUsbAutoshare().setEnabled(true);
} else {
getView().getEnableUsbAutoshare().disable(constants.enableUsbSupportNotAvailable());
}
}
use of org.ovirt.engine.ui.uicommonweb.models.ConsoleProtocol in project ovirt-engine by oVirt.
the class ConsoleOptionsFrontendPersisterImpl method loadConsolesWithKeymaker.
private void loadConsolesWithKeymaker(VmConsoles consoles, KeyMaker keyMaker) {
String selectedProtocolString = clientStorage.getLocalItem(keyMaker.make(SELECTED_PROTOCOL));
if (selectedProtocolString == null || "".equals(selectedProtocolString)) {
setOptionsDefaults(consoles);
return;
}
ConsoleProtocol selectedProtocol = ConsoleProtocol.valueOf(selectedProtocolString);
if (!consoles.canSelectProtocol(selectedProtocol)) {
setOptionsDefaults(consoles);
return;
}
if (selectedProtocol == ConsoleProtocol.SPICE) {
loadSpiceData(consoles, keyMaker);
} else if (selectedProtocol == ConsoleProtocol.VNC) {
loadVncData(consoles, keyMaker);
} else if (selectedProtocol == ConsoleProtocol.RDP) {
loadRdpData(consoles, keyMaker);
}
}
use of org.ovirt.engine.ui.uicommonweb.models.ConsoleProtocol in project ovirt-engine by oVirt.
the class ConsoleOptionsFrontendPersisterImpl method storeConsolesInternal.
private void storeConsolesInternal(VmConsoles consoles, boolean isPool) {
ConsoleProtocol selectedProtocol = consoles.getSelectedProcotol();
ConsoleContext context = consoles.getConsoleContext();
String id = consoles.getEntityId().toString();
KeyMaker keyMaker = new KeyMaker(id, isPool, context);
clientStorage.setLocalItem(keyMaker.make(SELECTED_PROTOCOL), selectedProtocol.toString());
if (selectedProtocol == ConsoleProtocol.SPICE) {
storeSpiceData(consoles, keyMaker);
} else if (selectedProtocol == ConsoleProtocol.VNC) {
storeVncData(consoles, keyMaker);
} else if (selectedProtocol == ConsoleProtocol.RDP) {
storeRdpData(consoles, keyMaker);
}
}
Aggregations