Search in sources :

Example 1 with GwtModemAuthType

use of org.eclipse.kura.web.shared.model.GwtModemAuthType in project kura by eclipse.

the class TabModemUi method getUpdatedNetInterface.

@Override
public void getUpdatedNetInterface(GwtNetInterfaceConfig updatedNetIf) {
    GwtModemInterfaceConfig updatedModemNetIf = (GwtModemInterfaceConfig) updatedNetIf;
    if (this.model.getText() != null && this.service.getText() != null) {
        // note - status is set in tcp/ip tab
        updatedModemNetIf.setPppNum(Integer.parseInt(this.number.getText()));
        updatedModemNetIf.setModemId(this.modem.getText().trim() != null ? this.modem.getText().trim() : "");
        updatedModemNetIf.setDialString(this.dial.getText().trim() != null ? this.dial.getText().trim() : "");
        updatedModemNetIf.setApn(this.apn.getText().trim() != null ? this.apn.getText().trim() : "");
        String authValue = this.auth.getSelectedValue();
        for (GwtModemAuthType authT : GwtModemAuthType.values()) {
            if (MessageUtils.get(authT.name()).equals(authValue)) {
                updatedModemNetIf.setAuthType(authT);
            }
        }
        if (updatedModemNetIf.getAuthType() != GwtModemAuthType.netModemAuthNONE) {
            updatedModemNetIf.setUsername(this.username.getText().trim() != null ? this.username.getText().trim() : "");
            updatedModemNetIf.setPassword(this.password.getText().trim() != null ? this.password.getText().trim() : "");
        }
        updatedModemNetIf.setResetTimeout(Integer.parseInt(this.reset.getValue().trim()));
        updatedModemNetIf.setPersist(this.radio1.getValue());
        updatedModemNetIf.setMaxFail(Integer.parseInt(this.maxfail.getText().trim()));
        updatedModemNetIf.setIdle(Integer.parseInt(this.idle.getText().trim()));
        updatedModemNetIf.setActiveFilter(this.active.getText() != "" ? this.active.getText().trim() : "");
        updatedModemNetIf.setLcpEchoInterval(Integer.parseInt(this.interval.getText().trim()));
        updatedModemNetIf.setLcpEchoFailure(Integer.parseInt(this.failure.getText().trim()));
    // ---
    } else {
        // initForm hasn't been called yet
        updatedModemNetIf.setPppNum(this.selectedNetIfConfig.getPppNum());
        updatedModemNetIf.setModemId(this.selectedNetIfConfig.getModemId());
        updatedModemNetIf.setDialString(this.selectedNetIfConfig.getDialString());
        updatedModemNetIf.setApn(this.selectedNetIfConfig.getApn());
        updatedModemNetIf.setAuthType(this.selectedNetIfConfig.getAuthType());
        updatedModemNetIf.setUsername(this.selectedNetIfConfig.getUsername());
        updatedModemNetIf.setPassword(this.selectedNetIfConfig.getPassword());
        updatedModemNetIf.setResetTimeout(this.selectedNetIfConfig.getResetTimeout());
        updatedModemNetIf.setPersist(this.selectedNetIfConfig.isPersist());
        updatedModemNetIf.setMaxFail(this.selectedNetIfConfig.getMaxFail());
        updatedModemNetIf.setIdle(this.selectedNetIfConfig.getIdle());
        updatedModemNetIf.setActiveFilter(this.selectedNetIfConfig.getActiveFilter());
        updatedModemNetIf.setLcpEchoInterval(this.selectedNetIfConfig.getLcpEchoInterval());
        updatedModemNetIf.setLcpEchoFailure(this.selectedNetIfConfig.getLcpEchoFailure());
    }
}
Also used : GwtModemAuthType(org.eclipse.kura.web.shared.model.GwtModemAuthType) GwtModemInterfaceConfig(org.eclipse.kura.web.shared.model.GwtModemInterfaceConfig)

Example 2 with GwtModemAuthType

use of org.eclipse.kura.web.shared.model.GwtModemAuthType in project kura by eclipse.

the class TabModemUi method update.

private void update() {
    if (this.selectedNetIfConfig != null) {
        this.model.setText(this.selectedNetIfConfig.getManufacturer() + "-" + this.selectedNetIfConfig.getModel());
        this.network.clear();
        List<String> networkTechnologies = this.selectedNetIfConfig.getNetworkTechnology();
        if (networkTechnologies != null && !networkTechnologies.isEmpty()) {
            for (String techType : this.selectedNetIfConfig.getNetworkTechnology()) {
                this.network.addItem(techType);
            }
        } else {
            this.network.addItem(MSGS.unknown());
        }
        this.service.setText(this.selectedNetIfConfig.getConnectionType());
        this.modem.setText(this.selectedNetIfConfig.getModemId());
        this.number.setText(String.valueOf(this.selectedNetIfConfig.getPppNum()));
        this.dial.setText(this.selectedNetIfConfig.getDialString());
        this.apn.setText(this.selectedNetIfConfig.getApn());
        GwtModemAuthType authType = GwtModemAuthType.netModemAuthNONE;
        if (this.selectedNetIfConfig.getAuthType() != null) {
            authType = this.selectedNetIfConfig.getAuthType();
        }
        for (int i = 0; i < this.auth.getItemCount(); i++) {
            if (this.auth.getItemText(i).equals(MessageUtils.get(authType.name()))) {
                this.auth.setSelectedIndex(i);
            }
        }
        this.username.setText(this.selectedNetIfConfig.getUsername());
        this.password.setText(this.selectedNetIfConfig.getPassword());
        this.reset.setText(String.valueOf(this.selectedNetIfConfig.getResetTimeout()));
        if (this.selectedNetIfConfig.isPersist()) {
            this.radio1.setActive(true);
            this.radio2.setActive(false);
        } else {
            this.radio1.setActive(false);
            this.radio2.setActive(true);
        }
        this.maxfail.setText(String.valueOf(this.selectedNetIfConfig.getMaxFail()));
        this.idle.setText(String.valueOf(this.selectedNetIfConfig.getIdle()));
        this.active.setText(this.selectedNetIfConfig.getActiveFilter());
        this.interval.setText(String.valueOf(this.selectedNetIfConfig.getLcpEchoInterval()));
        this.failure.setText(String.valueOf(this.selectedNetIfConfig.getLcpEchoFailure()));
    }
    refreshForm();
}
Also used : GwtModemAuthType(org.eclipse.kura.web.shared.model.GwtModemAuthType)

Example 3 with GwtModemAuthType

use of org.eclipse.kura.web.shared.model.GwtModemAuthType in project kura by eclipse.

the class TabModemUi method initForm.

// ----Private Methods----
private void initForm() {
    // MODEL
    this.labelModel.setText(MSGS.netModemModel());
    // NETWORK TECHNOLOGY
    this.labelNetwork.setText(MSGS.netModemNetworkTechnology());
    this.network.addItem(MSGS.unknown());
    this.network.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.network.isEnabled()) {
                TabModemUi.this.helpText.clear();
                TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipNetworkTopology()));
            }
        }
    });
    this.network.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    this.network.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            setDirty(true);
            refreshForm();
        }
    });
    // CONNECTION TYPE
    this.labelService.setText(MSGS.netModemConnectionType());
    // MODEM IDENTIFIER
    this.labelModem.setText(MSGS.netModemIdentifier());
    this.modem.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.modem.isEnabled()) {
                TabModemUi.this.helpText.clear();
                TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipModemIndentifier()));
            }
        }
    });
    this.modem.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    this.modem.addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            setDirty(true);
        }
    });
    // INTERFACE NUMBER
    this.labelNumber.setText(MSGS.netModemInterfaceNum() + "*");
    this.number.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            setDirty(true);
            if (TabModemUi.this.number.getText().trim() != null && (!TabModemUi.this.number.getText().trim().matches(REGEX_NUM) || Integer.parseInt(TabModemUi.this.number.getText()) < 0)) {
                TabModemUi.this.helpNumber.setText("This Field requires a numeric input");
                TabModemUi.this.groupNumber.setValidationState(ValidationState.ERROR);
            } else {
                TabModemUi.this.helpNumber.setText("");
                TabModemUi.this.groupNumber.setValidationState(ValidationState.NONE);
            }
        }
    });
    this.number.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.number.isEnabled()) {
                TabModemUi.this.helpText.clear();
                TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipModemInterfaceNumber()));
            }
        }
    });
    this.number.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    // DIAL STRING
    this.labelDial.setText(MSGS.netModemDialString() + "*");
    this.dial.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    this.dialString = "";
    String model = "";
    if (this.selectedNetIfConfig != null) {
        model = this.selectedNetIfConfig.getModel();
        if (model != null && model.length() > 0) {
            if (model.contains("HE910")) {
                this.dialString = this.defaultDialString.get("HE910");
            } else if (model.contains("DE910")) {
                this.dialString = this.defaultDialString.get("DE910");
            } else {
                this.dialString = "";
            }
        }
    }
    this.dial.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.dial.isEnabled()) {
                TabModemUi.this.helpText.clear();
                if (TabModemUi.this.dialString.equals("")) {
                    TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipDialStringDefault()));
                } else {
                    TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipDialString(TabModemUi.this.dial.getText())));
                }
            }
        }
    });
    this.dial.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            setDirty(true);
            if (TabModemUi.this.dial.getText() == null || "".equals(TabModemUi.this.dial.getText().trim())) {
                TabModemUi.this.groupDial.setValidationState(ValidationState.ERROR);
            } else {
                TabModemUi.this.groupDial.setValidationState(ValidationState.NONE);
            }
        }
    });
    // APN
    this.labelApn.setText(MSGS.netModemAPN() + "*");
    this.apn.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.apn.isEnabled()) {
                TabModemUi.this.helpText.clear();
                TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipApn()));
            }
        }
    });
    this.apn.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    this.apn.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            setDirty(true);
            if (TabModemUi.this.apn.getText() == null || "".equals(TabModemUi.this.apn.getText().trim())) {
                if (TabModemUi.this.apn.isEnabled()) {
                    TabModemUi.this.groupApn.setValidationState(ValidationState.ERROR);
                } else {
                    TabModemUi.this.groupApn.setValidationState(ValidationState.NONE);
                }
            } else {
                TabModemUi.this.groupApn.setValidationState(ValidationState.NONE);
            }
        }
    });
    // AUTH TYPE
    this.labelAuth.setText(MSGS.netModemAuthType());
    for (GwtModemAuthType a : GwtModemAuthType.values()) {
        this.auth.addItem(MessageUtils.get(a.name()));
    }
    this.auth.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.auth.isEnabled()) {
                TabModemUi.this.helpText.clear();
                TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipAuthentication()));
            }
        }
    });
    this.auth.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    this.auth.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            setDirty(true);
            refreshForm();
        }
    });
    // USERNAME
    this.labelUsername.setText(MSGS.netModemUsername());
    this.username.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.username.isEnabled()) {
                TabModemUi.this.helpText.clear();
                TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipUsername()));
            }
        }
    });
    this.username.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    this.username.addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            setDirty(true);
        }
    });
    // PASSWORD
    this.labelPassword.setText(MSGS.netModemPassword());
    this.password.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.network.isEnabled()) {
                TabModemUi.this.helpText.clear();
                TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipPassword()));
            }
        }
    });
    this.password.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    this.password.addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            setDirty(true);
        }
    });
    // MODEM RESET TIMEOUT
    this.labelReset.setText(MSGS.netModemResetTimeout() + "*");
    this.reset.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.reset.isEnabled()) {
                TabModemUi.this.helpText.clear();
                TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipResetTimeout()));
            }
        }
    });
    this.reset.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    this.reset.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            setDirty(true);
            if (TabModemUi.this.reset.getText().trim() != null && (!TabModemUi.this.reset.getText().trim().matches(REGEX_NUM) || Integer.parseInt(TabModemUi.this.reset.getText()) < 0 || Integer.parseInt(TabModemUi.this.reset.getText()) == 1)) {
                TabModemUi.this.helpReset.setText(MSGS.netModemInvalidResetTimeout());
                TabModemUi.this.groupReset.setValidationState(ValidationState.ERROR);
            } else {
                TabModemUi.this.helpReset.setText("");
                TabModemUi.this.groupReset.setValidationState(ValidationState.NONE);
            }
        }
    });
    // REOPEN CONNECTION ON TERMINATION
    this.labelPersist.setText(MSGS.netModemPersist());
    this.radio1.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.radio1.isEnabled()) {
                TabModemUi.this.helpText.clear();
                TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipPersist()));
            }
        }
    });
    this.radio1.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    this.radio2.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.radio2.isEnabled()) {
                TabModemUi.this.helpText.clear();
                TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipPersist()));
            }
        }
    });
    this.radio2.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    this.radio1.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            setDirty(true);
        }
    });
    this.radio2.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            setDirty(true);
        }
    });
    // CONNECTION ATTEMPTS
    this.labelMaxfail.setText(MSGS.netModemMaxFail() + "*");
    this.maxfail.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.maxfail.isEnabled()) {
                TabModemUi.this.helpText.clear();
                TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipMaxFail()));
            }
        }
    });
    this.maxfail.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    this.maxfail.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            setDirty(true);
            if (TabModemUi.this.maxfail.getText().trim() != null && (!TabModemUi.this.maxfail.getText().trim().matches(REGEX_NUM) || Integer.parseInt(TabModemUi.this.maxfail.getText()) <= 0) || TabModemUi.this.maxfail.getText().trim().length() <= 0) {
                TabModemUi.this.helpMaxfail.setText(MSGS.netModemInvalidMaxFail());
                TabModemUi.this.groupMaxfail.setValidationState(ValidationState.ERROR);
            } else {
                TabModemUi.this.helpMaxfail.setText("");
                TabModemUi.this.groupMaxfail.setValidationState(ValidationState.NONE);
            }
        }
    });
    // DISCONNET IF IDLE
    this.labelIdle.setText(MSGS.netModemIdle() + "*");
    this.idle.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.idle.isEnabled()) {
                TabModemUi.this.helpText.clear();
                TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipIdle()));
            }
        }
    });
    this.idle.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    this.idle.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            setDirty(true);
            if (TabModemUi.this.idle.getText().trim() != null && (!TabModemUi.this.idle.getText().trim().matches(REGEX_NUM) || Integer.parseInt(TabModemUi.this.idle.getText()) < 0)) {
                TabModemUi.this.helpIdle.setText(MSGS.netModemInvalidIdle());
                TabModemUi.this.groupIdle.setValidationState(ValidationState.ERROR);
            } else {
                TabModemUi.this.helpIdle.setText("");
                TabModemUi.this.groupIdle.setValidationState(ValidationState.NONE);
            }
        }
    });
    // ACTIVE FILTER
    this.labelActive.setText(MSGS.netModemActiveFilter());
    this.active.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.active.isEnabled()) {
                TabModemUi.this.helpText.clear();
                TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipActiveFilter()));
            }
        }
    });
    this.active.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    this.active.addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            setDirty(true);
        }
    });
    // LCP ECHO INTERVAL
    this.labelInterval.setText(MSGS.netModemLcpEchoInterval() + "*");
    this.interval.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.interval.isEnabled()) {
                TabModemUi.this.helpText.clear();
                TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipLcpEchoInterval()));
            }
        }
    });
    this.interval.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    this.interval.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            setDirty(true);
            if (TabModemUi.this.interval.getText().trim() != null && (!TabModemUi.this.interval.getText().trim().matches(REGEX_NUM) || Integer.parseInt(TabModemUi.this.interval.getText()) < 0)) {
                TabModemUi.this.helpInterval.setText(MSGS.netModemInvalidLcpEchoInterval());
                TabModemUi.this.groupInterval.setValidationState(ValidationState.ERROR);
            } else {
                TabModemUi.this.groupInterval.setValidationState(ValidationState.NONE);
            }
        }
    });
    // LCP ECHO FAILURE
    this.labelFailure.setText(MSGS.netModemLcpEchoFailure() + "*");
    this.failure.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            if (TabModemUi.this.failure.isEnabled()) {
                TabModemUi.this.helpText.clear();
                TabModemUi.this.helpText.add(new Span(MSGS.netModemToolTipLcpEchoFailure()));
            }
        }
    });
    this.failure.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetHelp();
        }
    });
    this.failure.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            setDirty(true);
            if (TabModemUi.this.failure.getText().trim() != null && (!TabModemUi.this.failure.getText().trim().matches(REGEX_NUM) || Integer.parseInt(TabModemUi.this.failure.getText()) < 0)) {
                TabModemUi.this.helpFailure.setText(MSGS.netModemInvalidLcpEchoFailure());
                TabModemUi.this.groupFailure.setValidationState(ValidationState.ERROR);
            } else {
                TabModemUi.this.helpFailure.setText("");
                TabModemUi.this.groupFailure.setValidationState(ValidationState.NONE);
            }
        }
    });
    this.helpTitle.setText(MSGS.netHelpTitle());
    this.radio1.setText(MSGS.trueLabel());
    this.radio2.setText(MSGS.falseLabel());
    this.radio1.setValue(true);
    this.radio2.setValue(false);
}
Also used : BlurHandler(com.google.gwt.event.dom.client.BlurHandler) GwtModemAuthType(org.eclipse.kura.web.shared.model.GwtModemAuthType) Span(org.gwtbootstrap3.client.ui.html.Span) MouseOutEvent(com.google.gwt.event.dom.client.MouseOutEvent) MouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) MouseOverEvent(com.google.gwt.event.dom.client.MouseOverEvent) MouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler) BlurEvent(com.google.gwt.event.dom.client.BlurEvent)

Example 4 with GwtModemAuthType

use of org.eclipse.kura.web.shared.model.GwtModemAuthType in project kura by eclipse.

the class ModemConfigTab method getUpdatedNetInterface.

public void getUpdatedNetInterface(GwtNetInterfaceConfig updatedNetIf) {
    GwtModemInterfaceConfig updatedModemNetIf = (GwtModemInterfaceConfig) updatedNetIf;
    if (m_formPanel != null) {
        updatedModemNetIf.setPppNum(m_ifaceNumField.getValue().intValue());
        String modemId = (m_modemIdField.getValue() != null) ? m_modemIdField.getValue() : "";
        updatedModemNetIf.setModemId(modemId);
        String dialString = (m_dialStringField.getValue() != null) ? m_dialStringField.getValue() : "";
        updatedModemNetIf.setDialString(dialString);
        String apn = (m_apnField.getValue() != null) ? m_apnField.getValue() : "";
        updatedModemNetIf.setApn(apn);
        String authValue = m_authTypeCombo.getSimpleValue();
        for (GwtModemAuthType auth : GwtModemAuthType.values()) {
            if (MessageUtils.get(auth.name()).equals(authValue)) {
                updatedModemNetIf.setAuthType(auth);
            }
        }
        if (updatedModemNetIf.getAuthType() != GwtModemAuthType.netModemAuthNONE) {
            String username = (m_usernameField.getValue() != null) ? m_usernameField.getValue() : "";
            updatedModemNetIf.setUsername(username);
            String password = (m_passwordField.getValue() != null) ? m_passwordField.getValue() : "";
            updatedModemNetIf.setPassword(password);
        }
        updatedModemNetIf.setResetTimeout(m_resetTimeoutField.getValue().intValue());
        updatedModemNetIf.setPersist(m_persistRadioTrue.getValue().booleanValue());
        updatedModemNetIf.setMaxFail(m_maxFailField.getValue().intValue());
        updatedModemNetIf.setIdle(m_idleField.getValue().intValue());
        String activeFilter = (m_activeFilterField.getValue() != null) ? m_activeFilterField.getValue() : "";
        updatedModemNetIf.setActiveFilter(activeFilter);
        updatedModemNetIf.setLcpEchoInterval(m_lcpEchoIntervalField.getValue().intValue());
        updatedModemNetIf.setLcpEchoFailure(m_lcpEchoFailureField.getValue().intValue());
    } else {
        if (m_selectNetIfConfig != null) {
            Log.debug("Modem config tab not yet rendered, using original values");
            updatedModemNetIf.setPppNum(m_selectNetIfConfig.getPppNum());
            updatedModemNetIf.setModemId(m_selectNetIfConfig.getModemId());
            updatedModemNetIf.setDialString(m_selectNetIfConfig.getDialString());
            updatedModemNetIf.setApn(m_selectNetIfConfig.getApn());
            updatedModemNetIf.setAuthType(m_selectNetIfConfig.getAuthType());
            updatedModemNetIf.setUsername(m_selectNetIfConfig.getUsername());
            updatedModemNetIf.setPassword(m_selectNetIfConfig.getPassword());
            updatedModemNetIf.setResetTimeout(m_selectNetIfConfig.getResetTimeout());
            updatedModemNetIf.setPersist(m_selectNetIfConfig.isPersist());
            updatedModemNetIf.setMaxFail(m_selectNetIfConfig.getMaxFail());
            updatedModemNetIf.setIdle(m_selectNetIfConfig.getIdle());
            updatedModemNetIf.setActiveFilter(m_selectNetIfConfig.getActiveFilter());
            updatedModemNetIf.setLcpEchoInterval(m_selectNetIfConfig.getLcpEchoInterval());
            updatedModemNetIf.setLcpEchoFailure(m_selectNetIfConfig.getLcpEchoFailure());
        }
    }
}
Also used : GwtModemAuthType(org.eclipse.kura.web.shared.model.GwtModemAuthType) GwtModemInterfaceConfig(org.eclipse.kura.web.shared.model.GwtModemInterfaceConfig)

Example 5 with GwtModemAuthType

use of org.eclipse.kura.web.shared.model.GwtModemAuthType in project kura by eclipse.

the class ModemConfigTab method update.

private void update() {
    Log.debug("ModemConfigTab - update()");
    for (Field<?> field : m_formPanel.getFields()) {
        FormUtils.removeDirtyFieldIcon(field);
    }
    if (m_selectNetIfConfig != null) {
        m_modemModel.setValue(m_selectNetIfConfig.getManufacturer() + " - " + m_selectNetIfConfig.getModel());
        List<String> networkTechnologies = m_selectNetIfConfig.getNetworkTechnology();
        if (networkTechnologies != null && networkTechnologies.size() > 0) {
            StringBuilder sbNetworkTechnologies = new StringBuilder();
            for (int i = 0; i < networkTechnologies.size(); i++) {
                String networkTechnology = networkTechnologies.get(i);
                sbNetworkTechnologies.append(networkTechnology);
                if (i < (networkTechnologies.size() - 1)) {
                    sbNetworkTechnologies.append('/');
                }
            }
            m_networkTechnologies.setValue(sbNetworkTechnologies.toString());
        } else {
            m_networkTechnologies.setValue(MSGS.unknown());
        }
        /*
		    m_networkTechCombo.removeAll();
		    List<String> networkTechnologies = m_selectNetIfConfig.getNetworkTechnology();
		    if(networkTechnologies != null && networkTechnologies.size() > 0) {
    		    for(String techType : m_selectNetIfConfig.getNetworkTechnology()) {
    		        m_networkTechCombo.add(techType);
    		    }
    		    m_networkTechCombo.setSimpleValue(m_selectNetIfConfig.getNetworkTechnology().get(0));
		    } else {
		        m_networkTechCombo.add(MSGS.unknown());
		        m_networkTechCombo.setSimpleValue(MSGS.unknown());
		    }
            m_networkTechCombo.setOriginalValue(m_networkTechCombo.getValue());
			*/
        m_connectionType.setValue(m_selectNetIfConfig.getConnectionType());
        m_modemIdField.setValue(m_selectNetIfConfig.getModemId());
        m_modemIdField.setOriginalValue(m_modemIdField.getValue());
        m_ifaceNumField.setValue(m_selectNetIfConfig.getPppNum());
        m_ifaceNumField.setOriginalValue(m_ifaceNumField.getValue());
        m_dialStringField.setValue(m_selectNetIfConfig.getDialString());
        m_dialStringField.setOriginalValue(m_dialStringField.getValue());
        m_apnField.setValue(m_selectNetIfConfig.getApn());
        m_apnField.setOriginalValue(m_apnField.getValue());
        GwtModemAuthType authType = GwtModemAuthType.netModemAuthNONE;
        if (m_selectNetIfConfig.getAuthType() != null) {
            authType = m_selectNetIfConfig.getAuthType();
        }
        m_authTypeCombo.setSimpleValue(MessageUtils.get(authType.name()));
        m_authTypeCombo.setOriginalValue(m_authTypeCombo.getValue());
        m_usernameField.setValue(m_selectNetIfConfig.getUsername());
        m_usernameField.setOriginalValue(m_usernameField.getValue());
        m_passwordField.setValue(m_selectNetIfConfig.getPassword());
        m_passwordField.setOriginalValue(m_passwordField.getValue());
        if (m_selectNetIfConfig.isPersist()) {
            m_persistRadioTrue.setValue(true);
            m_persistRadioTrue.setOriginalValue(m_persistRadioTrue.getValue());
            m_persistRadioFalse.setValue(false);
            m_persistRadioFalse.setOriginalValue(m_persistRadioFalse.getValue());
            m_persistRadioGroup.setOriginalValue(m_persistRadioTrue);
            m_persistRadioGroup.setValue(m_persistRadioGroup.getValue());
        } else {
            m_persistRadioTrue.setValue(false);
            m_persistRadioTrue.setOriginalValue(m_persistRadioTrue.getValue());
            m_persistRadioFalse.setValue(true);
            m_persistRadioFalse.setOriginalValue(m_persistRadioFalse.getValue());
            m_persistRadioGroup.setOriginalValue(m_persistRadioFalse);
            m_persistRadioGroup.setValue(m_persistRadioGroup.getValue());
        }
        m_resetTimeoutField.setValue(m_selectNetIfConfig.getResetTimeout());
        m_resetTimeoutField.setOriginalValue(m_resetTimeoutField.getValue());
        m_maxFailField.setValue(m_selectNetIfConfig.getMaxFail());
        m_maxFailField.setOriginalValue(m_maxFailField.getValue());
        m_idleField.setValue(m_selectNetIfConfig.getIdle());
        m_idleField.setOriginalValue(m_idleField.getValue());
        m_activeFilterField.setValue(m_selectNetIfConfig.getActiveFilter());
        m_activeFilterField.setOriginalValue(m_activeFilterField.getValue());
        m_lcpEchoIntervalField.setValue(m_selectNetIfConfig.getLcpEchoInterval());
        m_lcpEchoIntervalField.setOriginalValue(m_lcpEchoIntervalField.getValue());
        m_lcpEchoFailureField.setValue(m_selectNetIfConfig.getLcpEchoFailure());
        m_lcpEchoFailureField.setOriginalValue(m_lcpEchoFailureField.getValue());
    } else {
        Log.debug("selected Network Interface Config is null");
    }
    for (Field<?> field : m_formPanel.getFields()) {
        FormUtils.removeDirtyFieldIcon(field);
    }
    refreshForm();
}
Also used : GwtModemAuthType(org.eclipse.kura.web.shared.model.GwtModemAuthType)

Aggregations

GwtModemAuthType (org.eclipse.kura.web.shared.model.GwtModemAuthType)7 GwtModemInterfaceConfig (org.eclipse.kura.web.shared.model.GwtModemInterfaceConfig)3 FieldSet (com.extjs.gxt.ui.client.widget.form.FieldSet)1 FormPanel (com.extjs.gxt.ui.client.widget.form.FormPanel)1 LabelField (com.extjs.gxt.ui.client.widget.form.LabelField)1 NumberField (com.extjs.gxt.ui.client.widget.form.NumberField)1 Radio (com.extjs.gxt.ui.client.widget.form.Radio)1 RadioGroup (com.extjs.gxt.ui.client.widget.form.RadioGroup)1 SimpleComboValue (com.extjs.gxt.ui.client.widget.form.SimpleComboValue)1 Validator (com.extjs.gxt.ui.client.widget.form.Validator)1 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)1 FlowLayout (com.extjs.gxt.ui.client.widget.layout.FlowLayout)1 FormData (com.extjs.gxt.ui.client.widget.layout.FormData)1 FormLayout (com.extjs.gxt.ui.client.widget.layout.FormLayout)1 BlurEvent (com.google.gwt.event.dom.client.BlurEvent)1 BlurHandler (com.google.gwt.event.dom.client.BlurHandler)1 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 MouseOutEvent (com.google.gwt.event.dom.client.MouseOutEvent)1 MouseOutHandler (com.google.gwt.event.dom.client.MouseOutHandler)1