Package lcmc.cluster.ui.widget

Examples of lcmc.cluster.ui.widget.Widget


        if (globalInfo.getDrbdResources().size() <= 1) {
            for (final String commonP : COMMON_PARAMS) {
                if (!protocolInNetSection && DrbdXml.PROTOCOL_PARAM.equals(commonP)) {
                    continue;
                }
                final Widget wi = globalInfo.getWidget(commonP, null);
                if (wi == null) {
                    LOG.appError("widget for param: " + commonP + " was not created");
                    return null;
                }
                final Value value = dri.getComboBoxValue(commonP);
                globalInfo.getResource().setValue(commonP, value);
                wi.setValue(value);
            }
        }
        volumeDialog.init(this, getDrbdVolumeInfo());
        return volumeDialog;
    }
View Full Code Here


        if (globalInfo.getDrbdResources().size() <= 1) {
            for (final String commonP : COMMON_PARAMS) {
                if (!protocolInNetSection && DrbdXml.PROTOCOL_PARAM.equals(commonP)) {
                    continue;
                }
                final Widget widget = globalInfo.getWidget(commonP, null);
                if (widget == null) {
                    LOG.appError("widget for param: " + commonP + " was not created");
                    return new JPanel();
                }
                /* for the first resource set common options. */
                final Value commonValue = globalInfo.getResource().getValue(commonP);
                if (commonPreferredValue.containsKey(commonP)) {
                    final Value defaultValue = globalInfo.getParamDefault(commonP);
                    if (Tools.areEqual(defaultValue, commonValue)) {
                        widget.setValue(commonPreferredValue.get(commonP));
                        dri.getResource().setValue(commonP, commonPreferredValue.get(commonP));
                    } else {
                        dri.getResource().setValue(commonP, commonValue);
                    }
                }
View Full Code Here

                    /* we don't get this parameter from the dump. */
                    value = DrbdXml.CONFIG_YES;
                }
            }
            final Value oldValue = getParamSaved(param);
            final Widget wi = getWidget(param, null);
            if (!Tools.areEqual(value, oldValue)) {
                getResource().setValue(param, value);
                if (wi != null) {
                    wi.setValueAndWait(value);
                }
            }
        }
    }
View Full Code Here

     * Gets combo box for paremeter in te global config. usage-count is
     * disabled.
     */
    @Override
    protected Widget createWidget(final String param, final String prefix, final int width) {
        final Widget wi = super.createWidget(param, prefix, width);
        if ("usage-count".equals(param)) {
            wi.setEnabled(false);
        }
        return wi;
    }
View Full Code Here

    /** Returns true if some of the addresses have changed. */
    private boolean checkHostAddressesFieldsChanged() {
        boolean changed = false;
        for (final Host host : getHosts()) {
            final Widget wi = addressComboBoxHash.get(host);
            if (wi == null) {
                continue;
            }
            final Value haSaved = savedHostAddresses.get(host);
            final Value value = wi.getValue();
            if (!Tools.areEqual(haSaved, value)) {
                changed = true;
            }
        }
        /* port */
        final Widget pwi = portComboBox;
        if (pwi != null && !Tools.areEqual(savedPort, pwi.getValue())) {
            changed = true;
        }
        return changed;
    }
View Full Code Here

        for (final Host host : getHosts()) {
            final Host proxyHost = getProxyHost(host, !WIZARD);
            if (proxyHost == null) {
                continue;
            }
            final Widget wi = insideIpComboBoxHash.get(proxyHost);
            if (wi == null) {
                continue;
            }
            Value ipSaved = savedInsideIps.get(proxyHost);
            final Value defaultInsideIp = getDefaultInsideIp(proxyHost);
            if (ipSaved == null) {
                ipSaved = defaultInsideIp;
            }
            final Value value = wi.getValue();
            if (!Tools.areEqual(ipSaved, value)) {
                changed = true;
            }
        }

        for (final Host host : getHosts()) {
            final HostProxy hostProxy = dxml.getHostProxy(host.getName(), getName());
            final Host proxyHost;
            if (hostProxy != null) {
                proxyHost = getCluster().getProxyHostByName(hostProxy.getProxyHostName());
            } else {
                proxyHost = host;
            }
            final Widget wi = outsideIpComboBoxHash.get(proxyHost);
            if (wi == null) {
                continue;
            }
            final Value ipSaved = savedOutsideIps.get(proxyHost);
            final Value value = wi.getValue();
            if (!Tools.areEqual(ipSaved, value)) {
                changed = true;
            }
        }
        return changed;
View Full Code Here

        savedHostAddresses.clear();
        /* port */
        savedPort = portComboBox.getValue();
        /* addresses */
        for (final Host host : getHosts()) {
            final Widget wi = addressComboBoxHash.get(host);
            if (wi == null) {
                continue;
            }
            final Value address = wi.getValue();
            if (address == null || address.isNothingSelected()) {
                savedHostAddresses.remove(host);
            } else {
                savedHostAddresses.put(host, address);
            }
View Full Code Here

        savedInsidePort = sip;
        final Value sop = outsidePortComboBox.getValue();
        savedOutsidePort = sop;
        /* ips */
        for (final Host host : getConfiguredProxyHosts()) {
            final Widget insideWi = insideIpComboBoxHash.get(host);
            if (insideWi != null) {
                final Value insideIp = insideWi.getValue();
                if (insideIp == null || insideIp.isNothingSelected()) {
                    savedInsideIps.remove(host);
                } else {
                    savedInsideIps.put(host, insideIp);
                }
            }
            host.getBrowser().getUsedPorts().add(sip.getValueForConfig());

            final Widget outsideWi = outsideIpComboBoxHash.get(host);
            if (outsideWi != null) {
                final Value outsideIp = outsideWi.getValue();
                if (outsideIp == null || outsideIp.isNothingSelected()) {
                    savedOutsideIps.remove(host);
                } else {
                    savedOutsideIps.put(host, outsideIp);
                }
View Full Code Here

    }

    /** Hide/show proxy panels for selected hosts. */
    public void setProxyPanels(final boolean wizard) {
        final Collection<Host> visible = new HashSet<Host>();
        final Widget insidePortCB;
        final Widget outsidePortCB;
        final Widget portCB;
        if (wizard) {
            insidePortCB = insidePortComboBoxWizard;
            outsidePortCB = insidePortComboBoxWizard;
            portCB = portComboBoxWizard;
        } else {
            insidePortCB = insidePortComboBox;
            outsidePortCB = insidePortComboBox;
            portCB = portComboBox;
        }
        for (final Host host : getHosts()) {
            final Host proxyHost = getProxyHost(host, wizard);
            if (proxyHost != null) {
                visible.add(proxyHost);
            }
        }
        visible.addAll(selectedProxyHosts);
        final boolean isProxy = !visible.isEmpty();
        for (final Host pHost : getCluster().getProxyHosts()) {
            final String section = Tools.getString("ResourceInfo.Proxy") + pHost.getName();
            enableSection(section, visible.contains(pHost), wizard);
        }
        enableSection(SECTION_PROXY, isProxy, wizard);
        enableSection(SECTION_PROXY_PORTS, isProxy, wizard);
        final String portLabel;
        if (isProxy) {
            if (insidePortCB.isNew()
                && (savedInsidePort == null || savedInsidePort.isNothingSelected())) {
                insidePortCB.setValue(new StringValue(Integer.toString(getDefaultInsidePort())));
            }
            if (outsidePortCB.isNew()
                && (savedOutsidePort == null || savedOutsidePort.isNothingSelected())) {
                outsidePortCB.setValue(savedPort);
            }
            portLabel = Tools.getString("ResourceInfo.NetInterfacePortToProxy");

            globalInfo.enableProxySection(wizard); /* never disable */
        } else {
            portLabel = Tools.getString("ResourceInfo.NetInterfacePort");
        }
        portCB.getLabel().setText(portLabel);
        final Widget protocolWi = getWidget(DrbdXml.PROTOCOL_PARAM, Widget.WIZARD_PREFIX);
        final Widget pingTimeoutWi = getWidget(DrbdXml.PING_TIMEOUT_PARAM, Widget.WIZARD_PREFIX);
        final DrbdXml dxml = getBrowser().getDrbdXml();
        if (protocolWi != null && getResource().isNew()) {
            if (isProxy) {
                protocolWi.setValue(PROXY_DEFAULT_PROTOCOL);
                pingTimeoutWi.setValue(PROXY_DEFAULT_PING_TIMEOUT);
            } else {
                protocolWi.setValue(dxml.getParamPreferred(DrbdXml.PROTOCOL_PARAM));
                pingTimeoutWi.setValue(dxml.getParamDefault(DrbdXml.PING_TIMEOUT_PARAM));
            }
        }
    }
View Full Code Here

    private void addHostAddressListener(final boolean wizard,
                                        final MyButton thisApplyButton,
                                        final Map<Host, Widget> newIpComboBoxHash,
                                        final Map<Host, Widget> ipComboBoxHash) {
        for (final Host host : getHosts()) {
            final Widget wi;
            final Widget rwi;
            if (wizard) {
                wi = newIpComboBoxHash.get(host); /* wizard cb */
                rwi = ipComboBoxHash.get(host);
            } else {
                wi = newIpComboBoxHash.get(host); /* normal cb */
 
View Full Code Here

TOP

Related Classes of lcmc.cluster.ui.widget.Widget

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.