Package lcmc.common.ui.utils

Examples of lcmc.common.ui.utils.WidgetListener


                                                          Widget.NO_BUTTON);

            if (!getService().isNew()) {
                typeRadioGroup.setEnabled(false);
            }
            typeRadioGroup.addListeners(new WidgetListener() {
                @Override
                public void check(final Value value) {
                    typeRadioGroup.setEnabled(false);
                    changeType(value);
                }
View Full Code Here


    /** Adds listeners to all combo boxes. */
    private void addListeners() {
        /* drbd version combo box */
        drbdVersionCombo.addListeners(
            new WidgetListener() {
                @Override
                public void check(final Value value) {
                    enableComponentsLater(new JComponent[]{buttonClass(nextButton())});
                    disableComponents(new java.awt.Component[]{drbdBuildCombo.getComponent()});
                    final String item = drbdVersionCombo.getStringValue();
                    application.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            availBuilds();
                        }
                });
                }
            });

        /* build combo box */
        drbdBuildCombo.addListeners(
            new WidgetListener() {
                @Override
                public void check(final Value value) {
                    final String item = drbdBuildCombo.getStringValue();
                    getDrbdInstallation().setDrbdBuildToInstall(item);
                    availFiles();
View Full Code Here

    }

    private void addListeners() {
        /* listeners, that disallow to select anything. */
        /* distribution combo box */
        drbdDistributionWidget.addListeners(new WidgetListener() {
                    @Override
                    public void check(final Value value) {
                        String v = getHost().getDistributionVersion();
                        if (drbdDistItems == null || !drbdDistItems.contains(v)) {
                            v = NO_MATCH_STRING;
                        }
                        drbdDistributionWidget.setValue(new StringValue(v));
                    }
                });


        /* kernel version combo box */
        drbdKernelDirWidget.addListeners(
                new WidgetListener() {
                    @Override
                    public void check(final Value value) {
                        String v = getHost().getKernelVersion();
                        if (drbdKernelDirItems == null || !drbdKernelDirItems.contains(v)) {
                            v = NO_MATCH_STRING;
                        }
                        drbdKernelDirWidget.setValue(new StringValue(v));
                    }
                });

        /* arch combo box */
        drbdArchWidget.addListeners(new WidgetListener() {
                    @Override
                    public void check(final Value value) {
                        enableComponentsLater(new JComponent[]{buttonClass(nextButton())});
                        getHost().setArch(drbdArchWidget.getStringValue());
                        availVersionsForDist();
View Full Code Here

                                         Widget.NO_BUTTON);
        maxSizeWidget.setEnabled(false);
        inputPane.add(maxSizeLabel);
        inputPane.add(maxSizeWidget.getComponent());
        inputPane.add(new JLabel());
        sizeWidget.addListeners(new WidgetListener() {
            @Override
            public void check(final Value value) {
                enableResizeButton(true);
            }
        });
View Full Code Here

                                      new AccessMode(AccessMode.OP, AccessMode.NORMAL),
                                      Widget.NO_BUTTON);
        inputPane.add(new JLabel("LV Name"));
        inputPane.add(lvNameWidget.getComponent());
        inputPane.add(new JLabel());
        lvNameWidget.addListeners(new WidgetListener() {
            @Override
            public void check(final Value value) {
                checkButtons();
            }
        });

        final String maxBlockSize = getMaxBlockSize(selectedHosts);
        /* size */
        final String newBlockSize = Long.toString(Long.parseLong(maxBlockSize) / 2);
        final JLabel sizeLabel = new JLabel("New Size");

        lvSizeWidget = widgetFactory.createInstance(
                                       Widget.Type.TEXTFIELDWITHUNIT,
                                       VmsXml.convertKilobytes(newBlockSize),
                                       Widget.NO_ITEMS,
                                       getUnits(),
                                       Widget.NO_REGEXP,
                                       250,
                                       Widget.NO_ABBRV,
                                       new AccessMode(AccessMode.OP, AccessMode.NORMAL),
                                       Widget.NO_BUTTON);
        inputPane.add(sizeLabel);
        inputPane.add(lvSizeWidget.getComponent());
        createButton.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() {
                                enableCreateButton(false);
                            }
                        });
                        disableComponents();
                        getProgressBar().start(LV_CREATE_TIMEOUT * hostCheckBoxes.size());
                        boolean oneFailed = false;
                        for (final Map.Entry<Host, JCheckBox> hostEntry : hostCheckBoxes.entrySet()) {
                            if (hostEntry.getValue().isSelected()) {
                                final boolean ret = lvCreate(hostEntry.getKey(),
                                                             lvNameWidget.getStringValue(),
                                                             lvSizeWidget.getStringValue());
                                if (!ret) {
                                    oneFailed = true;
                                }
                            }
                        }
                        for (final Host h : hostCheckBoxes.keySet()) {
                            h.getBrowser().getClusterBrowser().updateHWInfo(h, Host.UPDATE_LVM);
                        }
                        final String maxBlockSize = getMaxBlockSize(getSelectedHostCbs());
                        maxSizeWidget.setValue(VmsXml.convertKilobytes(maxBlockSize));
                        enableComponents();
                        if (oneFailed) {
                            progressBarDoneError();
                        } else {
                            progressBarDone();
                        }
                    }
                });
                thread.start();
            }
        });
        inputPane.add(createButton);
        /* max size */
        final JLabel maxSizeLabel = new JLabel("Max Size");
        maxSizeLabel.setEnabled(false);
        maxSizeWidget = widgetFactory.createInstance(
                                      Widget.Type.TEXTFIELDWITHUNIT,
                                      VmsXml.convertKilobytes(maxBlockSize),
                                      Widget.NO_ITEMS,
                                      getUnits(),
                                      Widget.NO_REGEXP,
                                      250,
                                      Widget.NO_ABBRV,
                                      new AccessMode(AccessMode.OP, AccessMode.NORMAL),
                                      Widget.NO_BUTTON);
        maxSizeWidget.setEnabled(false);
        inputPane.add(maxSizeLabel);
        inputPane.add(maxSizeWidget.getComponent());
        inputPane.add(new JLabel());
        lvSizeWidget.addListeners(new WidgetListener() {
            @Override
            public void check(final Value value) {
                checkButtons();
            }
        });
View Full Code Here

                                      new AccessMode(AccessMode.OP, AccessMode.NORMAL),
                                      Widget.NO_BUTTON);
        inputPane.add(new JLabel("LV Name"));
        inputPane.add(lvNameWi.getComponent());
        inputPane.add(new JLabel());
        lvNameWi.addListeners(new WidgetListener() {
                                  @Override
                                  public void check(final Value value) {
                                      checkButtons();
                                  }
                              });

        final String maxBlockSize = getMaxBlockSizeAvailableInGroup();
        /* size */
        final String newBlockSize = Long.toString(Long.parseLong(maxBlockSize) / 2);
        final JLabel sizeLabel = new JLabel("New Size");

        sizeWi =  widgetFactory.createInstance(
                       Widget.Type.TEXTFIELDWITHUNIT,
                       VmsXml.convertKilobytes(newBlockSize),
                       Widget.NO_ITEMS,
                       getUnits(),
                       Widget.NO_REGEXP,
                       250,
                       Widget.NO_ABBRV,
                       new AccessMode(AccessMode.OP, AccessMode.NORMAL),
                       Widget.NO_BUTTON);
        inputPane.add(sizeLabel);
        inputPane.add(sizeWi.getComponent());
        snapshotButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                final Thread thread = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        application.invokeAndWait(new EnableSnapshotRunnable(false));
                        disableComponents();
                        getProgressBar().start(SNAPSHOT_TIMEOUT);
                        final boolean ret = lvSnapshot(lvNameWi.getStringValue(), sizeWi.getStringValue());
                        final Host host = blockDevInfo.getHost();
                        host.getBrowser().getClusterBrowser().updateHWInfo(host, Host.UPDATE_LVM);
                        setComboBoxes();
                        if (ret) {
                            progressBarDone();
                            disposeDialog();
                        } else {
                            progressBarDoneError();
                        }
                        enableComponents();
                    }
                });
                thread.start();
            }
        });

        inputPane.add(snapshotButton);
        /* max size */
        final JLabel maxSizeLabel = new JLabel("Max Size");
        maxSizeLabel.setEnabled(false);
        maxSizeWi =  widgetFactory.createInstance(
                        Widget.Type.TEXTFIELDWITHUNIT,
                        VmsXml.convertKilobytes(maxBlockSize),
                        Widget.NO_ITEMS,
                        getUnits(),
                        Widget.NO_REGEXP,
                        250,
                        Widget.NO_ABBRV,
                        new AccessMode(AccessMode.OP, AccessMode.NORMAL),
                        Widget.NO_BUTTON);
        maxSizeWi.setEnabled(false);
        inputPane.add(maxSizeLabel);
        inputPane.add(maxSizeWi.getComponent());
        inputPane.add(new JLabel());
        sizeWi.addListeners(new WidgetListener() {
                                @Override
                                public void check(final Value value) {
                                    checkButtons();
                                }
                            });
View Full Code Here

                    instMethodWidget.setSelectedIndex(
                            Integer.parseInt(application.getAutoOptionHost(autoOption)));
                }
            });
        }
        instMethodWidget.addListeners(new WidgetListener() {
            @Override
            public void check(final Value value) {
                final InstallMethods method = (InstallMethods) instMethodWidget.getValue();
                final String toolTip = getInstToolTip(prefix, method.getIndex());
                application.invokeLater(new Runnable() {
View Full Code Here

        //TODO: escape dir
    }

    /** Adds combo box listener for the parameter. */
    private void addParamComboListeners(final Widget paramWi) {
        paramWi.addListeners(new WidgetListener() {
                                 @Override
                                 public void check(final Value value) {
                                     if (fstypeParamWidget != null) {
                                         if (!(value instanceof Info)) {
                                             return;
View Full Code Here

        }

        inputPane.add(metadataLabel);
        inputPane.add(metadataWidget.getComponent());
        metadataWidget.addListeners(
                new WidgetListener() {
                    @Override
                    public void check(final Value value) {
                        if (metadataWidget.getStringValue().equals(useExistingMetadata)) {
                            makeMetaDataButton.setEnabled(false);
                            buttonClass(nextButton()).setEnabled(true);
View Full Code Here

                                                        Widget.NO_REGEXP,
                                                        COMBOBOX_WIDTH,
                                                        Widget.NO_ABBRV,
                                                        new AccessMode(AccessMode.RO, AccessMode.NORMAL),
                                                        Widget.NO_BUTTON);
        hostChoiceWidget.addListeners(new WidgetListener() {
            @Override
            public void check(final Value value) {
                checkButtons();
            }
        });
        inputPane.add(hostLabel);
        inputPane.add(hostChoiceWidget.getComponent());
        inputPane.add(new JLabel(""));

        /* Filesystem */
        final JLabel filesystemLabel = new JLabel(Tools.getString("Dialog.DrbdConfig.CreateFS.Filesystem"));
        final Value defaultValue = NO_FILESYSTEM_STRING;
        final Value[] filesystems = getDrbdVolumeInfo().getDrbdResourceInfo().getCommonFileSystems( defaultValue);

        filesystemWidget = widgetFactory.createInstance(Widget.Type.COMBOBOX,
                                                        defaultValue,
                                                        filesystems,
                                                        Widget.NO_REGEXP,
                                                        COMBOBOX_WIDTH,
                                                        Widget.NO_ABBRV,
                                                        new AccessMode(AccessMode.RO, AccessMode.NORMAL),
                                                        Widget.NO_BUTTON);
        if (application.getAutoOptionGlobal("autodrbd") != null) {
            filesystemWidget.setValueAndWait(new StringValue("ext3"));
        }
        inputPane.add(filesystemLabel);
        inputPane.add(filesystemWidget.getComponent());
        filesystemWidget.addListeners(new WidgetListener() {
            @Override
            public void check(final Value value) {
                if (NO_HOST_STRING.equals(hostChoiceWidget.getValue())
                    && !NO_FILESYSTEM_STRING.equals(filesystemWidget.getValue())) {
                    hostChoiceWidget.setValue(hosts[1]);
View Full Code Here

TOP

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

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.