Package lcmc.common.ui.utils

Examples of lcmc.common.ui.utils.MyButton


                    LOG.sshError(host, "", answer, stacktrace, errorCode);
                }

            };
        // TODO: disable buttons if disconnected?
        final MyButton procDrbdButton = widgetFactory.createButton("Show Proxy Info");
        procDrbdButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                host.execCommand(new ExecCommandConfig().commandString("DRBD.showProxyInfo")
                                                        .execCallback(execCallback));
            }
View Full Code Here


        return nodeChanged;
    }

    /** Returns button for defined hosts. */
    private MyButton getHostButton(final Host host, final String prefix) {
        final MyButton hostBtn = widgetFactory.createButton("Start", null, "not defined on " + host.getName());
        application.makeMiniButton(hostBtn);
        final MyButton hBtn = hostBtn;
        application.invokeLater(new Runnable() {
            @Override
            public void run() {
                hBtn.setBackgroundColor(Browser.PANEL_BACKGROUND);
            }
        });
        hostBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                LOG.debug1("actionPerformed: BUTTON: host: " + host.getName());
                final Thread t = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        final VmsXml vxml = getBrowser().getVmsXml(host);
                        if (vxml != null) {
                            if (hBtn.getIcon() == VNC_ICON) {
                                final int remotePort = vxml.getRemotePort(getDomainName());
                                application.startTightVncViewer(host, remotePort);
                            } else if (hBtn.getIcon() == HostBrowser.HOST_ON_ICON) {
                                application.invokeLater(new Runnable() {
                                    @Override
                                    public void run() {
                                        hBtn.setEnabled(false);
                                    }
                                });
                                start(host);
                            }
                        }
View Full Code Here

                    || (vmsXml != null && vmsXml.getDomainNames().contains(getDomainName())))) {
                defaultValue = DEFINED_ON_HOST_TRUE;
            } else {
                defaultValue = DEFINED_ON_HOST_FALSE;
            }
            final MyButton hostBtn = getHostButton(host, prefix);
            final Widget wi = widgetFactory.createInstance(
                    Widget.Type.CHECKBOX,
                    defaultValue,
                    Widget.NO_ITEMS,
                    Widget.NO_REGEXP,
View Full Code Here

        final JPanel extraButtonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING, 0, 0));
        extraButtonPanel.setBackground(Browser.BUTTON_PANEL_BACKGROUND);
        buttonPanel.add(extraButtonPanel);
        addApplyButton(buttonPanel);
        addRevertButton(extraButtonPanel);
        final MyButton overviewButton = widgetFactory.createButton("VMs Overview", BACK_ICON);
        application.makeMiniButton(overviewButton);
        overviewButton.setPreferredSize(new Dimension(130, 50));
        overviewButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                LOG.debug1("actionPerformed: BUTTON: overview");
                getBrowser().getVmsInfo().selectMyself();
            }
        });
        extraButtonPanel.add(overviewButton);
        /* define on hosts */
        optionsPanel.add(getDefinedOnHostsPanel(null, getApplyButton()));
        addParams(optionsPanel,
                  params,
                  application.getServiceLabelWidth(),
                  application.getServiceFieldWidth() * 2,
                  null);
        /* Actions */
        buttonPanel.add(getActionsButton(), BorderLayout.LINE_END);
        mainPanel.add(optionsPanel);

        final MyButton newDiskBtn = getNewDiskBtn();
        final MyButton newFilesystemBtn = getNewFilesystemBtn();
        final MyButton newInterfaceBtn = getNewInterfaceBtn();
        final MyButton newInputBtn = getNewInputDevBtn();
        final MyButton newGraphicsBtn = getNewGraphicsBtn();
        final MyButton newSoundBtn = getNewSoundBtn();
        final MyButton newSerialBtn = getNewSerialBtn();
        final MyButton newParallelBtn = getNewParallelBtn();
        final MyButton newVideoBtn = getNewVideoBtn();
        /* new video button */
        mainPanel.add(getTablePanel("Disks", DISK_TABLE, newDiskBtn));
        mainPanel.add(getTablePanel("Filesystems", FILESYSTEM_TABLE, newFilesystemBtn));

        mainPanel.add(Box.createVerticalStrut(20));
View Full Code Here

            final DefaultMutableTreeNode thisNode = getNode();
            if (thisNode != null) {
                for (final Info info : treeMenuController.nodesToInfos(thisNode.children())) {
                    final HardwareInfo hardwareInfo = (HardwareInfo) info;
                    if (hardwareInfo != null) {
                        final MyButton applyButton = hardwareInfo.getApplyButton();
                        if (applyButton != null) {
                            applyButton.setVisible(true);
                        }
                    }
                }
            }
        }
View Full Code Here

                break;
            }
        }
        rowColor = newColor;
        if (domainName != null) {
            final MyButton domainNameLabel = widgetFactory.createButton(domainName, hostIcon);
            domainNameLabel.setOpaque(true);
            final MyButton removeDomain = widgetFactory.createButton("Remove",
                                                       ClusterBrowser.REMOVE_ICON_SMALL,
                                                       "Remove " + domainName + " domain");
            application.makeMiniButton(removeDomain);
            rows.add(new Object[]{domainNameLabel,
                                  getDefinedOnString(),
View Full Code Here

                                      final Map<String, DiskData> disks,
                                      final boolean opaque) {
        if (disks == null) {
            return new Object[0];
        }
        final MyButton removeBtn = widgetFactory.createButton("Remove",
                                                ClusterBrowser.REMOVE_ICON_SMALL,
                                                "Remove " + targetDev);
        application.makeMiniButton(removeBtn);
        final DiskData diskData = disks.get(targetDev);
        if (diskData == null) {
            return new Object[]{targetDev, "unknown", removeBtn};
        }
        final StringBuilder target = new StringBuilder(10);
        target.append(diskData.getTargetBusType());
        target.append(" : /dev/");
        target.append(targetDev);
        if (dkti != null) {
            mDiskToInfoLock.lock();
            final DiskInfo vdi;
            try {
                vdi = diskToInfo.get(targetDev);
            } finally {
                mDiskToInfoLock.unlock();
            }
            dkti.put(target.toString(), vdi);
        }
        final MyButton targetDevLabel = widgetFactory.createButton(target.toString(), BlockDevInfo.HARDDISK_ICON_LARGE);
        targetDevLabel.setOpaque(opaque);
        final StringBuilder source = new StringBuilder(20);
        String s = diskData.getSourceDev();
        if (s == null) {
            s = diskData.getSourceFile();
        }
View Full Code Here

        crmShowInProgress = true;
        final JTextArea ta = new JTextArea(Tools.getString("HostInfo.crmShellLoading"));
        ta.setEditable(false);
        ta.setFont(f);

        final MyButton crmConfigureCommitButton =
                      widgetFactory.createButton(Tools.getString("HostInfo.crmShellCommitButton"), Browser.APPLY_ICON);
        registerComponentEnableAccessMode(crmConfigureCommitButton,
                                          new AccessMode(AccessMode.ADMIN, AccessMode.NORMAL));
        final MyButton hostInfoButton = widgetFactory.createButton(Tools.getString("HostInfo.crmShellStatusButton"));
        application.makeMiniButton(hostInfoButton);

        final MyButton crmConfigureShowButton =
                                           widgetFactory.createButton(Tools.getString("HostInfo.crmShellShowButton"));
        application.makeMiniButton(crmConfigureShowButton);
        crmConfigureCommitButton.setEnabled(false);
        final ExecCallback execCallback =
            new ExecCallback() {
                @Override
                public void done(final String answer) {
                    ta.setText(answer);
                    application.invokeLater(new Runnable() {
                    @Override
                        public void run() {
                            crmConfigureShowButton.setEnabled(true);
                            hostInfoButton.setEnabled(true);
                            crmShowInProgress = false;
                        }
                    });
                }

                @Override
                public void doneError(final String answer, final int errorCode) {
                    ta.setText(answer);
                    LOG.sshError(host, "", answer, "", errorCode);
                    application.invokeLater(new Runnable() {
                    @Override
                        public void run() {
                            crmConfigureCommitButton.setEnabled(false);
                        }
                    });
                }

            };
        hostInfoButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                registerComponentEditAccessMode(ta, new AccessMode(AccessMode.GOD, AccessMode.NORMAL));
                crmInfoShowing = true;
                hostInfoButton.setEnabled(false);
                crmConfigureCommitButton.setEnabled(false);
                String command = "HostBrowser.getHostInfo";
                if (!host.hasCorosyncInitScript()) {
                    command = "HostBrowser.getHostInfoHeartbeat";
                }
                host.execCommand(new ExecCommandConfig().commandString(command)
                                                        .execCallback(execCallback)
                                                        .silentCommand()
                                                        .silentOutput()
                                                        .sshCommandTimeout(Ssh.DEFAULT_COMMAND_TIMEOUT));
            }
        });
        host.registerEnableOnConnect(hostInfoButton);

        crmConfigureShowButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                registerComponentEditAccessMode(ta, new AccessMode(AccessMode.ADMIN, AccessMode.NORMAL));
                updateAdvancedPanels();
                crmShowInProgress = true;
                crmInfoShowing = false;
                crmConfigureShowButton.setEnabled(false);
                crmConfigureCommitButton.setEnabled(false);
                host.execCommand(new ExecCommandConfig().commandString("HostBrowser.getCrmConfigureShow")
                                                        .execCallback(execCallback)
                                                        .sshCommandTimeout(Ssh.DEFAULT_COMMAND_TIMEOUT));
            }
View Full Code Here

                                            final Map<String, FilesystemData> filesystems,
                                            final boolean opaque) {
        if (filesystems == null) {
            return new Object[0];
        }
        final MyButton removeBtn = widgetFactory.createButton("Remove", ClusterBrowser.REMOVE_ICON_SMALL, "Remove " + targetDev);
        application.makeMiniButton(removeBtn);
        final FilesystemData filesystemData = filesystems.get(targetDev);
        if (filesystemData == null) {
            return new Object[]{targetDev, "unknown", removeBtn};
        }
        final StringBuilder target = new StringBuilder(10);
        target.append(filesystemData.getTargetDir());
        if (dkti != null) {
            mFilesystemToInfoLock.lock();
            FilesystemInfo vdi;
            try {
                vdi = filesystemToInfo.get(targetDev);
            } finally {
                mFilesystemToInfoLock.unlock();
            }
            dkti.put(target.toString(), vdi);
        }
        final MyButton targetDevLabel = widgetFactory.createButton(target.toString(), BlockDevInfo.HARDDISK_ICON_LARGE);
        targetDevLabel.setOpaque(opaque);
        final StringBuilder source = new StringBuilder(20);
        String s = filesystemData.getSourceDir();
        if (s == null) {
            s = filesystemData.getSourceDir();
        }
View Full Code Here

                                           final Map<String, InterfaceData> interfaces,
                                           final boolean opaque) {
        if (interfaces == null) {
            return new Object[0];
        }
        final MyButton removeBtn = widgetFactory.createButton("Remove",
                                                ClusterBrowser.REMOVE_ICON_SMALL,
                                                "Remove " + mac);
        application.makeMiniButton(removeBtn);
        final InterfaceData interfaceData = interfaces.get(mac);
        if (interfaceData == null) {
            return new Object[]{mac, "unknown", removeBtn};
        }
        final StringBuilder interf = new StringBuilder(20);
        interf.append(mac);
        final String dev = interfaceData.getTargetDev();
        if (dev != null) {
            interf.append(' ');
            interf.append(dev);
        }
        if (iToInfo != null) {
            final InterfaceInfo vii = interfaceToInfo.get(mac);
            iToInfo.put(interf.toString(), vii);
        }
        final MyButton iLabel = widgetFactory.createButton(interf.toString(), NetInfo.NET_INTERFACE_ICON_LARGE);
        iLabel.setOpaque(opaque);
        final StringBuilder source = new StringBuilder(20);
        final String type = interfaceData.getType();
        final String s;
        if ("network".equals(type)) {
            s = interfaceData.getSourceNetwork();
View Full Code Here

TOP

Related Classes of lcmc.common.ui.utils.MyButton

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.