Search in sources :

Example 1 with ConsoleClient

use of org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleClient in project ovirt-engine by oVirt.

the class ConsolePopupPresenterWidget method initListeners.

private void initListeners(final ConsolePopupModel model) {
    ConsoleClient spice = model.getVmConsoles().getConsoleModel(SpiceConsoleModel.class).getSpiceImpl();
    if (spice == null) {
        return;
    }
    viewUpdatingListener = (ev, sender, args) -> getView().edit(model);
}
Also used : SpiceConsoleModel(org.ovirt.engine.ui.uicommonweb.models.vms.SpiceConsoleModel) ConsoleClient(org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleClient)

Example 2 with ConsoleClient

use of org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleClient 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());
    }
}
Also used : DynamicMessages(org.ovirt.engine.ui.uicommonweb.DynamicMessages) UsbPolicy(org.ovirt.engine.core.common.businessentities.UsbPolicy) CommonApplicationConstants(org.ovirt.engine.ui.common.CommonApplicationConstants) Inject(com.google.inject.Inject) IEventListener(org.ovirt.engine.ui.uicompat.IEventListener) ConsoleUtils(org.ovirt.engine.ui.uicommonweb.ConsoleUtils) HasValueChangeHandlers(com.google.gwt.event.logical.shared.HasValueChangeHandlers) ConsoleOptions(org.ovirt.engine.core.common.console.ConsoleOptions) RdpConsoleModel(org.ovirt.engine.ui.uicommonweb.models.vms.RdpConsoleModel) AssetProvider(org.ovirt.engine.ui.common.gin.AssetProvider) AbstractModelBoundPopupPresenterWidget(org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget) Window(com.google.gwt.user.client.Window) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) SpiceConsoleModel(org.ovirt.engine.ui.uicommonweb.models.vms.SpiceConsoleModel) ConsoleProtocol(org.ovirt.engine.ui.uicommonweb.models.ConsoleProtocol) ConsoleClient(org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleClient) GenEvent(com.gwtplatform.dispatch.annotation.GenEvent) EventBus(com.google.gwt.event.shared.EventBus) ConsoleOptionsFrontendPersister(org.ovirt.engine.ui.uicommonweb.ConsoleOptionsFrontendPersister) ConsolePopupModel(org.ovirt.engine.ui.uicommonweb.models.ConsolePopupModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) VmConsoles(org.ovirt.engine.ui.uicommonweb.models.VmConsoles) HasClickHandlers(com.google.gwt.event.dom.client.HasClickHandlers) VmConsolesImpl(org.ovirt.engine.ui.uicommonweb.models.VmConsolesImpl) HasEnabledWithHints(org.ovirt.engine.ui.common.widget.HasEnabledWithHints) VncConsoleModel(org.ovirt.engine.ui.uicommonweb.models.vms.VncConsoleModel) ConsoleProtocol(org.ovirt.engine.ui.uicommonweb.models.ConsoleProtocol) SpiceConsoleModel(org.ovirt.engine.ui.uicommonweb.models.vms.SpiceConsoleModel) VmConsoles(org.ovirt.engine.ui.uicommonweb.models.VmConsoles) ConsoleClient(org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleClient)

Example 3 with ConsoleClient

use of org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleClient in project ovirt-engine by oVirt.

the class ConsoleOptionsFrontendPersisterImpl method loadSpiceData.

protected void loadSpiceData(VmConsoles vmConsoles, KeyMaker keyMaker) {
    vmConsoles.selectProtocol(ConsoleProtocol.SPICE);
    try {
        vmConsoles.getConsoleModel(SpiceConsoleModel.class).initConsole();
    } catch (Exception e) {
        // $NON-NLS-1$
        logger.log(Level.WARNING, "Failed loading SPICE data. Exception message: " + e.getMessage());
    }
    ConsoleClient spice = asSpice(vmConsoles);
    if (vmConsoles.getConsoleModel(SpiceConsoleModel.class).isWanOptionsAvailableForMyVm()) {
        spice.getOptions().setWanOptionsEnabled(readBool(keyMaker.make(WAN_OPTIONS)));
    }
    if (consoleUtils.isSpiceProxyDefined(vmConsoles.getVm())) {
        spice.getOptions().setSpiceProxyEnabled(readBool(keyMaker.make(SPICE_PROXY_ENABLED)));
    }
    spice.getOptions().setFullScreen(readBool(keyMaker.make(OPEN_IN_FULL_SCREEN)));
    spice.getOptions().setSmartcardEnabledOverridden(readBool(keyMaker.make(SMARTCARD_ENABLED_OVERRIDDEN)));
    spice.getOptions().setUsbAutoShare(readBool(keyMaker.make(USB_AUTOSHARE)));
    spice.getOptions().setRemapCtrlAltDelete(readBool(keyMaker.make(REMAP_CAD_SPICE), getRemapCtrlAltDelDefault()));
}
Also used : SpiceConsoleModel(org.ovirt.engine.ui.uicommonweb.models.vms.SpiceConsoleModel) ConsoleClient(org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleClient)

Example 4 with ConsoleClient

use of org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleClient in project ovirt-engine by oVirt.

the class ConsoleOptionsFrontendPersisterImpl method storeSpiceData.

protected void storeSpiceData(VmConsoles vmConsoles, KeyMaker keyMaker) {
    ConsoleClient spice = asSpice(vmConsoles);
    storeBool(keyMaker.make(OPEN_IN_FULL_SCREEN), spice.getOptions().isFullScreen());
    storeBool(keyMaker.make(SMARTCARD_ENABLED_OVERRIDDEN), spice.getOptions().isSmartcardEnabledOverridden());
    storeBool(keyMaker.make(WAN_OPTIONS), spice.getOptions().isWanOptionsEnabled());
    storeBool(keyMaker.make(USB_AUTOSHARE), spice.getOptions().isUsbAutoShare());
    storeBool(keyMaker.make(SPICE_PROXY_ENABLED), spice.getOptions().isSpiceProxyEnabled());
    storeBool(keyMaker.make(REMAP_CAD_SPICE), spice.getOptions().isRemapCtrlAltDelete());
}
Also used : ConsoleClient(org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleClient)

Aggregations

ConsoleClient (org.ovirt.engine.ui.uicommonweb.models.vms.ConsoleClient)4 SpiceConsoleModel (org.ovirt.engine.ui.uicommonweb.models.vms.SpiceConsoleModel)3 HasClickHandlers (com.google.gwt.event.dom.client.HasClickHandlers)1 HasValueChangeHandlers (com.google.gwt.event.logical.shared.HasValueChangeHandlers)1 EventBus (com.google.gwt.event.shared.EventBus)1 Window (com.google.gwt.user.client.Window)1 Inject (com.google.inject.Inject)1 GenEvent (com.gwtplatform.dispatch.annotation.GenEvent)1 UsbPolicy (org.ovirt.engine.core.common.businessentities.UsbPolicy)1 ConsoleOptions (org.ovirt.engine.core.common.console.ConsoleOptions)1 CommonApplicationConstants (org.ovirt.engine.ui.common.CommonApplicationConstants)1 AssetProvider (org.ovirt.engine.ui.common.gin.AssetProvider)1 AbstractModelBoundPopupPresenterWidget (org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget)1 HasEnabledWithHints (org.ovirt.engine.ui.common.widget.HasEnabledWithHints)1 ConsoleOptionsFrontendPersister (org.ovirt.engine.ui.uicommonweb.ConsoleOptionsFrontendPersister)1 ConsoleUtils (org.ovirt.engine.ui.uicommonweb.ConsoleUtils)1 DynamicMessages (org.ovirt.engine.ui.uicommonweb.DynamicMessages)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1 ConsolePopupModel (org.ovirt.engine.ui.uicommonweb.models.ConsolePopupModel)1 ConsoleProtocol (org.ovirt.engine.ui.uicommonweb.models.ConsoleProtocol)1