Package lcmc.cluster.ui.widget

Examples of lcmc.cluster.ui.widget.Widget


    protected void addHostLocationsListeners() {
        final String[] params = getParametersFromXML();
        for (final Host host : getBrowser().getClusterHosts()) {
            final HostInfo hi = host.getBrowser().getHostInfo();
            final Widget wi = scoreComboBoxHash.get(hi);
            wi.addListeners(new WidgetListener() {
                                @Override
                                public void check(final Value value) {
                                    setApplyButtons(CACHED_FIELD, params);
                                    application.invokeLater(
                                        new Runnable() {
                                            @Override
                                            public void run() {
                                                wi.setEditable();
                                            }
                                    });
                                }
                                @Override
                                public void checkText(final String text) {
                                    setApplyButtons(CACHED_FIELD, params);
                                    final Value v = wi.getValue();
                                    if (v == null || v.isNothingSelected()) {
                                        wi.setText("");
                                    }
                                }
                            });
        }
        pingComboBox.addListeners(new WidgetListener() {
View Full Code Here


    private void addOperationListeners(final String op, final String param) {
        final Value dv = resourceAgent.getOperationDefault(op, param);
        if (dv == null || dv.isNothingSelected()) {
            return;
        }
        final Widget wi;
        mOperationsComboBoxHashReadLock.lock();
        try {
            wi = operationsComboBoxHash.get(op, param);
        } finally {
            mOperationsComboBoxHashReadLock.unlock();
        }
        final String[] params = getParametersFromXML();
        wi.addListeners(new WidgetListener() {
                            @Override
                            public void check(final Value value) {
                                setApplyButtons(CACHED_FIELD, params);
                            }
                        });
View Full Code Here

            addHostLocations(optionsPanel, application.getServiceLabelWidth(), application.getServiceFieldWidth());
        }

        for (final String param : params) {
            if (isMetaAttr(param)) {
                final Widget wi = getWidget(param, null);
                wi.setEnabled(savedMAIdRef == null);
            }
        }
        if (!getService().isNew()) {
            getWidget(GUI_ID, null).setEnabled(false);
        }
View Full Code Here

    /** Goes through the scores and sets preferred locations. */
    protected void setLocations(final String heartbeatId, final Host dcHost, final Application.RunMode runMode) {
        final ClusterStatus cs = getBrowser().getClusterStatus();
        for (final Host host : getBrowser().getClusterHosts()) {
            final HostInfo hi = host.getBrowser().getHostInfo();
            final Widget wi = scoreComboBoxHash.get(hi);
            String hs = wi.getStringValue();
            if ("ALWAYS".equals(hs)) {
                hs = CrmXml.INFINITY_VALUE.getValueForConfig();
            } else if ("NEVER".equals(hs)) {
                hs = CrmXml.MINUS_INFINITY_VALUE.getValueForConfig();
            }
            final HostLocation hlSaved = savedHostLocations.get(hi);
            String opSaved = null;
            if (hlSaved != null) {
                opSaved = hlSaved.getOperation();
            }
            final String onHost = hi.getName();
            final String op = getOpFromLabel(onHost, wi.getLabel().getText());
            final HostLocation hostLoc = new HostLocation(hs, op, null, null);
            if (!hostLoc.equals(hlSaved)) {
                String locationId = cs.getLocationId(getHeartbeatId(runMode), onHost, runMode);
                if ((hs == null || hs.isEmpty() || !Tools.areEqual(op, opSaved))
                    && locationId != null) {
                    CRM.removeLocation(dcHost, locationId, getHeartbeatId(runMode), runMode);
                    locationId = null;
                }
                if (hs != null && !hs.isEmpty()) {
                    CRM.setLocation(dcHost,
                                    getHeartbeatId(runMode),
                                    onHost,
                                    hostLoc,
                                    locationId,
                                    runMode);
                }
            }
        }
        /* ping */
        final Widget pwi = pingComboBox;
        if (pwi != null) {
            final Value value = pwi.getValue();
            if (!Tools.areEqual(savedPingOperation, value)) {
                final String pingLocationId = cs.getPingLocationId(getHeartbeatId(runMode), runMode);
                if (pingLocationId != null) {
                    CRM.removeLocation(dcHost, pingLocationId, getHeartbeatId(runMode), runMode);
                }
View Full Code Here

                if (getBrowser().getCrmOperationParams(op).contains(param)) {
                    if (ci == null
                        && (ClusterBrowser.CRM_DEMOTE_OPERATOR.equals(op) || ClusterBrowser.CRM_PROMOTE_OPERATOR.equals(op))) {
                        continue;
                    }
                    final Widget wi;
                    mOperationsComboBoxHashReadLock.lock();
                    try {
                        wi = operationsComboBoxHash.get(op, param);
                    } finally {
                        mOperationsComboBoxHashReadLock.unlock();
                    }
                    final Value value;
                    if (wi == null) {
                        if (CrmXml.PARAM_OCF_CHECK_LEVEL.equals(param)) {
                            value = NOTHING_SELECTED_VALUE;
                        } else {
                            value = new StringValue("0");
                        }
                    } else {
                        value = wi.getValue();
                    }
                    if (value != null && !value.isNothingSelected()) {
                        if (wi != null && firstTime) {
                            opHash.put("id", opId);
                            opHash.put("name", op);
View Full Code Here

            }
        }
        for (final String param : params) {
            if (!sameAs || !isMetaAttr(param)) {
                final Value v = getParamSaved(param);
                final Widget wi = getWidget(param, null);
                if (wi != null && !Tools.areEqual(wi.getValue(), v)) {
                    if (v == null || v.isNothingSelected()) {
                        wi.setValue(null);
                    } else {
                        wi.setValue(v);
                    }
                }
            }
        }
        final GroupInfo gInfo = groupInfo;
View Full Code Here

    /** Revert locations to saved values. */
    protected final void revertLocations() {
        for (final Host host : getBrowser().getClusterHosts()) {
            final HostInfo hi = host.getBrowser().getHostInfo();
            final HostLocation savedLocation = savedHostLocations.get(hi);
            final Widget wi = scoreComboBoxHash.get(hi);
            if (wi == null) {
                continue;
            }

            String score = null;
            String op = null;
            if (savedLocation != null) {
                score = savedLocation.getScore();
                op = savedLocation.getOperation();
            }
            wi.setValue(new StringValue(score));
            final JLabel label = wi.getLabel();
            final String text = getHostLocationLabel(hi.getName(), op);
            label.setText(text);
        }
        /* pingd */
        final Widget pwi = pingComboBox;
        if (pwi != null) {
            final Value spo = savedPingOperation;
            if (spo == null || spo.isNothingSelected()) {
                pwi.setValue(null);
            } else {
                pwi.setValue(PING_ATTRIBUTES.get(spo.getValueForConfig()));
            }
        }
    }
View Full Code Here

                    continue;
                }
                if (ClusterBrowser.CRM_OPERATIONS_WITH_IGNORED_DEFAULT.contains(op)) {
                    defaultValue = null;
                }
                final Widget wi;
                mOperationsComboBoxHashReadLock.lock();
                try {
                    wi = operationsComboBoxHash.get(op, param);
                } finally {
                    mOperationsComboBoxHashReadLock.unlock();
                }
                Value value = wi.getValue();
                if (value == null || value.isNothingSelected()) {
                    value = getOpDefaultsDefault(param);
                }
                if (!Tools.areEqual(defaultValue, value)) {
                }
                if (!Tools.areEqual(defaultValue, savedOperation.get(op, param))) {
                    allSavedAreDefaultValues = false;
                }
            }
        }
        final ServiceInfo savedOpIdRef = savedOperationIdRef;
        ServiceInfo operationIdRef = null;
        final Value ref = sameAsOperationsWiValue();
        if (ref instanceof ServiceInfo) {
            operationIdRef = (ServiceInfo) ref;
        }
        boolean sameAs = false;
        if (!Tools.areEqual(operationIdRef, savedOpIdRef)) {
            if (savedOpIdRef == null) {
                if (allSavedAreDefaultValues) {
                    sameAsOperationsWi.setValue(OPERATIONS_DEFAULT_VALUES);
                } else {
                    if (operationIdRef != null) {
                        sameAsOperationsWi.setValue(null);
                    }
                }
            } else {
                sameAs = true;
                sameAsOperationsWi.setValue(savedOpIdRef);
            }
        }
        if (!sameAs) {
            for (final String op : getResourceAgent().getOperationNames()) {
                for (final String param : getBrowser().getCrmOperationParams(op)) {
                    final Value value = savedOperation.get(op, param);
                    final Widget wi;
                    mOperationsComboBoxHashReadLock.lock();
                    try {
                        wi = operationsComboBoxHash.get(op, param);
                    } finally {
                        mOperationsComboBoxHashReadLock.unlock();
                    }
                    if (wi != null) {
                        application.invokeLater(new Runnable() {
                            @Override
                            public void run() {
                                wi.setEnabled(savedOpIdRef == null);
                            }
                        });
                        if (value != null) {
                            wi.setValue(value);
                        }
                    }
                }
            }
        }
View Full Code Here

            for (final String param : getBrowser().getCrmOperationParams(op)) {
                final Value defaultValue = resourceAgent.getOperationDefault(op, param);
                if (defaultValue == null || defaultValue.isNothingSelected()) {
                    continue;
                }
                final Widget wi;
                mOperationsComboBoxHashReadLock.lock();
                try {
                    wi = operationsComboBoxHash.get(op, param);
                } finally {
                    mOperationsComboBoxHashReadLock.unlock();
                }
                savedOperation.put(op, param, wi.getValue());
            }
        }
        mSavedOperationsLock.unlock();
    }
View Full Code Here

                    value = getParamDefault(param);
                }
                final Value oldValue = getParamSaved(param);
                if (!Tools.areEqual(value, oldValue)) {
                    getResource().setValue(param, value);
                    final Widget wi = getWidget(param, null);
                    if (wi != null) {
                        wi.setValue(value);
                    }
                }
            }
        }
    }
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.