Package lcmc.vm.ui.resource

Examples of lcmc.vm.ui.resource.DomainInfo


        mVmsUpdateLock.lock();
        boolean nodeChanged = false;
        if (vmsNode != null) {
            for (final Info info : treeMenuController.nodesToInfos(vmsNode.children())) {
                final DomainInfo domainInfo = (DomainInfo) info;
                if (domainNames.contains(domainInfo.toString())) {
                    /* keeping */
                    currentVMSVDIs.add(domainInfo);
                    domainNames.remove(domainInfo.toString());
                    domainInfo.updateParameters(); /* update old */
                } else {
                    if (!domainInfo.getResource().isNew()) {
                        /* remove not existing vms */
                        nodesToRemove.add(domainInfo.getNode());
                        domainInfo.setNode(null);
                        nodeChanged = true;
                    }
                }
            }
        }

        treeMenuController.removeFromParent(nodesToRemove);
        if (vmsNode == null) {
            mVmsUpdateLock.unlock();
            return;
        }
        for (final String domainName : domainNames) {
            int i = 0;
            for (final Info info : treeMenuController.nodesToInfos(vmsNode.children())) {
                final DomainInfo domainInfo = (DomainInfo) info;
                final String name = domainInfo.getName();
                if (domainName != null && name != null && domainName.compareTo(domainInfo.getName()) < 0) {
                    break;
                }
                i++;
            }
            /* add new vms nodes */
            final DomainInfo domainInfo = domainInfoProvider.get();
            domainInfo.init(domainName, this);
            currentVMSVDIs.add(domainInfo);
            treeMenuController.createMenuItem(vmsNode, domainInfo, i);
            domainInfo.updateParameters();
            nodeChanged = true;
        }
        mVmsUpdateLock.unlock();
        if (nodeChanged) {
            treeMenuController.reloadNode(vmsNode, false);
        }
        for (final ServiceInfo si : getExistingServiceList(null)) {
            final DomainInfo vmsvdi = si.connectWithVMS();
            if (vmsvdi != null) {
                /* keep the not connected ones.*/
                currentVMSVDIs.remove(vmsvdi);
            }
        }
        for (final DomainInfo vmsvdi : currentVMSVDIs) {
            vmsvdi.setUsedByCRM(false);
        }
        final VMListInfo vmsi = (VMListInfo) vmsNode.getUserObject();
        if (vmsi != null) {
            vmsi.updateTable(VMListInfo.MAIN_TABLE);
        }
View Full Code Here


     * name.
     */
    public DomainInfo findVMSVirtualDomainInfo(final String name) {
        if (vmsNode != null && name != null) {
            for (final Info info : treeMenuController.nodesToInfos(vmsNode.children())) {
                final DomainInfo domainInfo = (DomainInfo) info;
                if (name.equals(domainInfo.getName())) {
                    return domainInfo;
                }
            }
        }
        return null;
View Full Code Here

            dri.updateAllVolumes();
        }

        if (vmsNode != null) {
            for (final Info info : treeMenuController.nodesToInfos(vmsNode.children())) {
                final DomainInfo domainInfo = (DomainInfo) info;
                domainInfo.checkResourceFields(null, domainInfo.getParametersFromXML());
                domainInfo.updateAdvancedPanels();
                for (final Info grandChild : treeMenuController.nodesToInfos(domainInfo.getNode().children())) {
                    final HardwareInfo hardwareInfo = (HardwareInfo) grandChild;
                    hardwareInfo.checkResourceFields(null, hardwareInfo.getParametersFromXML());
                    hardwareInfo.updateAdvancedPanels();
                }
            }
View Full Code Here

    }

    @Override
    protected void initDialogAfterVisible() {
        super.initDialogAfterVisible();
        final DomainInfo vdi = getVMSVirtualDomainInfo();
        final boolean cor = vdi.checkResourceFields(null, PARAMS).isCorrect();
        if (cor || nextDialogObject != null) {
            enableComponents();
        } else {
            /* don't enable */
            enableComponents(new JComponent[]{buttonClass(nextButton())});
View Full Code Here

        });
    }

    @Override
    protected JComponent getInputPane() {
        final DomainInfo vdi = getVMSVirtualDomainInfo();
        vdi.waitForInfoPanel();
        if (inputPane != null) {
            return inputPane;
        }
        final JPanel panel = new JPanel();
        panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));

        final JPanel optionsPanel = new JPanel();
        optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.PAGE_AXIS));
        optionsPanel.setAlignmentY(java.awt.Component.TOP_ALIGNMENT);

        vdi.getResource().setValue(VmsXml.VM_PARAM_BOOT, DomainInfo.BOOT_CDROM);
        vdi.savePreferredValues();
        vdi.addWizardParams(optionsPanel,
                            PARAMS,
                            buttonClass(nextButton()),
                            application.getDefaultSize("Dialog.vm.Resource.LabelWidth"),
                            application.getDefaultSize("Dialog.vm.Resource.FieldWidth"),
                            null);
        domainNameWidget = vdi.getWidget(VmsXml.VM_PARAM_NAME, Widget.WIZARD_PREFIX);
        panel.add(optionsPanel);

        final JScrollPane scrollPane = new JScrollPane(panel);
        scrollPane.setMaximumSize(new Dimension(Short.MAX_VALUE, 200));
        scrollPane.setPreferredSize(new Dimension(Short.MAX_VALUE, 200));
View Full Code Here

        });
    }

    @Override
    protected JComponent getInputPane() {
        final DomainInfo domainInfo = getVMSVirtualDomainInfo();
        domainInfo.selectMyself();
        if (inputPane != null) {
            return inputPane;
        }
        final JPanel panel = new JPanel();
        panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
        final MyButton createConfigBtn = widgetFactory.createButton("Create Config");
        createConfigBtn.setBackgroundColor(Tools.getDefaultColor("ConfigDialog.Button"));
        createConfigBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                final Thread thread = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        application.invokeAndWait(new Runnable() {
                            @Override
                            public void run() {
                                createConfigBtn.setEnabled(false);
                            }
                        });
                        domainInfo.apply(Application.RunMode.LIVE);
                        application.invokeLater(new Runnable() {
                            @Override
                            public void run() {
                                buttonClass(finishButton()).setEnabled(true);
                            }
                        });
                    }
                });
                thread.start();
            }
        });
        final JPanel optionsPanel = new JPanel();
        optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.PAGE_AXIS));
        optionsPanel.setAlignmentY(java.awt.Component.TOP_ALIGNMENT);
        domainInfo.waitForInfoPanel();
        optionsPanel.add(domainInfo.getDefinedOnHostsPanel(Widget.WIZARD_PREFIX, createConfigBtn));

        optionsPanel.add(createConfigBtn);
        panel.add(optionsPanel);

        final JScrollPane scrollPane = new JScrollPane(panel);
View Full Code Here

                    })
                .addAction(new MenuAction() {
                        @Override
                        public void run(final String text) {
                    virtualDomainInfo.hidePopup();
                    final DomainInfo vvdi = domainInfo;
                    final VmsXml vxml = virtualDomainInfo.getVMSXML(getRunningOnHost());
                    if (vxml != null && vvdi != null) {
                        final int remotePort = vxml.getRemotePort(vvdi.getName());
                        final Host host = vxml.getDefinedOnHost();
                        if (host != null && remotePort > 0) {
                            application.startTightVncViewer(host, remotePort);
                        }
                    }
                }});
            items.add(tightvncViewerMenu);
        }

        if (application.isUseUltravnc()) {
            /* ultra vnc test menu */
            final UpdatableItem ultravncViewerMenu = menuFactory.createMenuItem(
                            "start ULTRA VNC viewer",
                            null,
                            null,
                            new AccessMode(AccessMode.RO, AccessMode.NORMAL),
                            new AccessMode(AccessMode.RO, AccessMode.NORMAL))
                    .enablePredicate(new EnablePredicate() {
                            @Override
                            public String check() {
                    final VmsXml vxml = virtualDomainInfo.getVMSXML(getRunningOnHost());
                    if (vxml == null || domainInfo == null) {
                        return "VM is not available";
                    }
                    final int remotePort = vxml.getRemotePort(domainInfo.getName());
                    if (remotePort <= 0) {
                        return "remote port is not greater than 0";
                    }
                    return null;
                }})
                .addAction(new MenuAction() {
                        @Override
                        public void run(final String text) {
                    virtualDomainInfo.hidePopup();
                    final DomainInfo vvdi = domainInfo;
                    final VmsXml vxml = virtualDomainInfo.getVMSXML(getRunningOnHost());
                    if (vxml != null && vvdi != null) {
                        final int remotePort = vxml.getRemotePort(vvdi.getName());
                        final Host host = vxml.getDefinedOnHost();
                        if (host != null && remotePort > 0) {
                            application.startUltraVncViewer(host, remotePort);
                        }
                    }
                }});
            items.add(ultravncViewerMenu);
        }

        if (application.isUseRealvnc()) {
            /* real vnc test menu */
            final UpdatableItem realvncViewerMenu = menuFactory.createMenuItem(
                            "start REAL VNC test",
                            null,
                            null,
                            new AccessMode(AccessMode.RO, AccessMode.NORMAL),
                            new AccessMode(AccessMode.RO, AccessMode.NORMAL))
                    .enablePredicate(new EnablePredicate() {
                            @Override
                            public String check() {
                    final VmsXml vxml = virtualDomainInfo.getVMSXML(getRunningOnHost());
                    if (vxml == null || domainInfo == null) {
                        return "VM is not available";
                    }
                    final int remotePort = vxml.getRemotePort(domainInfo.getName());
                    if (remotePort <= 0) {
                        return "remote port is not greater than 0";
                    }
                    return null;
                }})
                .addAction(new MenuAction() {
                        @Override
                        public void run(final String text) {
                    virtualDomainInfo.hidePopup();
                    final DomainInfo vvdi = domainInfo;
                    final VmsXml vxml = virtualDomainInfo.getVMSXML(getRunningOnHost());
                    if (vxml != null && vvdi != null) {
                        final int remotePort = vxml.getRemotePort(vvdi.getName());
                        final Host host = vxml.getDefinedOnHost();
                        if (host != null && remotePort > 0) {
                            application.startRealVncViewer(host, remotePort);
                        }
                    }
View Full Code Here

    /** Connects with DomainInfo object. */
    @Override
    public DomainInfo connectWithVMS() {
        final Value config = getParamSaved(CONFIG_PARAM);
        DomainInfo newVMSVDI = null;
        for (final Host host : getBrowser().getClusterHosts()) {
            final VmsXml vxml = getBrowser().getVmsXml(host);
            if (vxml != null) {
                final String name = vxml.getNameFromConfig(config.getValueForConfig());
                newVMSVDI = getBrowser().findVMSVirtualDomainInfo(name);
                if (newVMSVDI != null) {
                    newVMSVDI.setUsedByCRM(true);
                    break;
                }
            }
        }
        domainInfo = newVMSVDI;
View Full Code Here

TOP

Related Classes of lcmc.vm.ui.resource.DomainInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.