use of org.eclipse.kura.web.shared.model.GwtNetIfStatus in project kura by eclipse.
the class WirelessConfigTab method refreshForm.
private void refreshForm() {
if (m_formPanel != null) {
GwtNetIfStatus tcpIpStatus = m_tcpIpConfigTab.getStatus();
// tcp/ip disabled
if (tcpIpStatus.equals(GwtNetIfStatus.netIPv4StatusDisabled)) {
m_channelPanel.setEnabled(false);
for (Field<?> field : m_formPanel.getFields()) {
field.setEnabled(false);
}
// wireless disabled - leave mode selectable
/*
} else if (GwtWifiWirelessMode.netWifiWirelessModeDisabled.equals(wifiMode)) {
m_channelPanel.setEnabled(false);
for (Field<?> field : m_formPanel.getFields()) {
field.setEnabled(false);
}
m_modeCombo.setEnabled(true);
*/
} else {
m_channelPanel.setEnabled(true);
for (Field<?> field : m_formPanel.getFields()) {
field.setEnabled(true);
field.clearInvalid();
field.validate();
}
// Station mode
if (GwtWifiWirelessMode.netWifiWirelessModeStation.equals(m_modeCombo.getValue().getMode())) {
for (Field<?> field : m_formPanel.getFields()) {
if (field != m_modeCombo && field != m_ssidField && field != m_securityCombo && field != m_pairwiseCiphersCombo && field != m_groupCiphersCombo && field != m_passwordField && field != m_bgscanModuleCombo && field != m_bgscanRssiThresholdSliderField && field != m_bgscanShortIntervalField && field != m_bgscanLongIntervalField && field != m_pingAccessPointRadioTrue && field != m_pingAccessPointRadioFalse && field != m_pingAccessPointRadioGroup && field != m_ignoreSsidRadioGroup) {
field.setEnabled(false);
}
}
m_verifyPasswordField.setAllowBlank(true);
/*
// Ad-hoc mode
} else if(GwtWifiWirelessMode.netWifiWirelessModeAdHoc.equals(m_modeCombo.getValue().getMode())) {
for (Field<?> field : m_formPanel.getFields()) {
if (field != m_modeCombo
&& field != m_ssidField
&& field != m_securityCombo
&& field != m_passwordField) {
field.setEnabled(false);
}
}
*/
// Access Point mode
} else if (GwtWifiWirelessMode.netWifiWirelessModeAccessPoint.equals(m_modeCombo.getValue().getMode())) {
// Disable Access Point mode when TCP/IP is set to WAN
if (tcpIpStatus.equals(GwtNetIfStatus.netIPv4StatusEnabledWAN)) {
for (Field<?> field : m_formPanel.getFields()) {
if (field != m_modeCombo) {
field.setEnabled(false);
}
}
m_verifyPasswordField.setAllowBlank(false);
}
}
// disable password fields if security is None
if (m_securityCombo.getSimpleValue().equals(MessageUtils.get(GwtWifiSecurity.netWifiSecurityNONE.name()))) {
m_passwordField.setEnabled(false, false);
m_verifyPasswordField.setEnabled(false);
m_passwordField.clearInvalid();
m_verifyPasswordField.clearInvalid();
}
if (GwtWifiWirelessMode.netWifiWirelessModeStation.equals(m_modeCombo.getValue().getMode())) {
m_ssidField.setEnabled(true, true);
if (!m_securityCombo.getSimpleValue().equals(MessageUtils.get(GwtWifiSecurity.netWifiSecurityNONE.name()))) {
if ((m_passwordField.getValue() != null) && (m_passwordField.getValue().length() > 0)) {
m_passwordField.setEnabled(true, true);
} else {
m_passwordField.setEnabled(true, false);
}
}
for (Field<?> field : m_formPanel.getFields()) {
if (field.equals(m_bgscanModuleCombo)) {
field.setEnabled(true);
} else if (field.equals(m_bgscanRssiThresholdSliderField) || field.equals(m_bgscanShortIntervalField) || field.equals(m_bgscanLongIntervalField)) {
if ((m_bgscanModuleCombo.getSimpleValue().equals(MessageUtils.get(GwtWifiBgscanModule.netWifiBgscanMode_SIMPLE.name()))) || (m_bgscanModuleCombo.getSimpleValue().equals(MessageUtils.get(GwtWifiBgscanModule.netWifiBgscanMode_LEARN.name())))) {
field.setEnabled(true);
} else {
field.setEnabled(false);
}
}
}
} else {
m_ssidField.setEnabled(true, false);
if (!m_securityCombo.getSimpleValue().equals(MessageUtils.get(GwtWifiSecurity.netWifiSecurityNONE.name()))) {
m_passwordField.setEnabled(true, false);
}
for (Field<?> field : m_formPanel.getFields()) {
if (field.equals(m_bgscanModuleCombo) || field.equals(m_bgscanRssiThresholdSliderField) || field.equals(m_bgscanShortIntervalField) || field.equals(m_bgscanLongIntervalField) || field.equals(m_pingAccessPointRadioTrue) || field.equals(m_pingAccessPointRadioFalse) || field.equals(m_pingAccessPointRadioGroup)) {
field.setEnabled(false);
}
}
}
if ((m_securityCombo.getSimpleValue().equals(MessageUtils.get(GwtWifiSecurity.netWifiSecurityWPA2.name()))) || (m_securityCombo.getSimpleValue().equals(MessageUtils.get(GwtWifiSecurity.netWifiSecurityWPA.name()))) || (m_securityCombo.getSimpleValue().equals(MessageUtils.get(GwtWifiSecurity.netWifiSecurityWPA_WPA2.name())))) {
for (Field<?> field : m_formPanel.getFields()) {
/*
if (field.equals(m_pairwiseCiphersCombo)
|| field.equals(m_groupCiphersCombo)) {
*/
if (field.equals(m_groupCiphersCombo)) {
if (GwtWifiWirelessMode.netWifiWirelessModeStation.equals(m_modeCombo.getValue().getMode())) {
field.setEnabled(true);
} else {
field.setEnabled(false);
}
}
}
} else {
for (Field<?> field : m_formPanel.getFields()) {
if (field.equals(m_pairwiseCiphersCombo) || field.equals(m_groupCiphersCombo)) {
field.setEnabled(false);
}
}
}
}
m_netInterfaceConfigTabs.adjustInterfaceTabs();
}
}
use of org.eclipse.kura.web.shared.model.GwtNetIfStatus in project kura by eclipse.
the class NetInterfaceConfigTabs method adjustInterfaceTabs.
/*
public void addInterfaceTabs() {
removeInterfaceTabs();
if(m_netIfConfig != null) {
if ((m_netIfConfig instanceof GwtNetInterfaceConfig)
&& m_netIfConfig.getHwTypeEnum() != GwtNetIfType.LOOPBACK
&& !m_netIfConfig.getName().startsWith("mon.wlan")) {
m_tabsPanel.insert(m_tabDhcpNatConfig, 1);
}
if (m_netIfConfig instanceof GwtWifiNetInterfaceConfig) {
if (!m_netIfConfig.getName().startsWith("mon.wlan")) {
m_wirelessConfigTab.setNetInterface(m_netIfConfig);
m_tabsPanel.insert(m_tabWirelessConfig, 1);
m_tabsPanel.insert(m_tabDhcpNatConfig, 2);
}
}
else if (m_netIfConfig instanceof GwtModemInterfaceConfig) {
m_modemConfigTab.setNetInterface(m_netIfConfig);
m_tabsPanel.insert(m_tabModemConfig, 1);
m_tabsPanel.remove(m_tabDhcpNatConfig);
}
}
}
*/
// Add/remove tabs based on the selected settings in the various tabs
public void adjustInterfaceTabs() {
GwtNetIfStatus netIfStatus = m_tcpIpConfigTab.getStatus();
boolean includeDhcpNatTab = !m_tcpIpConfigTab.isDhcp() && netIfStatus.equals(GwtNetIfStatus.netIPv4StatusEnabledLAN);
Log.debug("includeDhcpNatTab? " + includeDhcpNatTab);
if (m_netIfConfig instanceof GwtWifiNetInterfaceConfig) {
Log.debug("insert wifi tab");
removeTab(m_tabModemConfig);
removeTab(m_tabModemGpsConfig);
insertTab(m_tabWirelessConfig, 1);
if (!m_tabWirelessConfig.isEnabled()) {
m_tabWirelessConfig.enable();
}
insertTab(m_tabDhcpNatConfig, 2);
// remove dhcp/nat tab if not an access point
if (!GwtWifiWirelessMode.netWifiWirelessModeAccessPoint.equals(m_wirelessConfigTab.getWirelessMode())) {
includeDhcpNatTab = false;
}
} else if (m_netIfConfig instanceof GwtModemInterfaceConfig) {
includeDhcpNatTab = false;
removeTab(m_tabWirelessConfig);
removeTab(m_tabDhcpNatConfig);
Log.debug("insert modem tab");
insertTab(m_tabModemConfig, 1);
if (!m_tabModemConfig.isEnabled()) {
m_tabModemConfig.enable();
}
Log.debug("insert modem gps tab");
insertTab(m_tabModemGpsConfig, 2);
} else {
removeTab(m_tabWirelessConfig);
removeTab(m_tabModemConfig);
removeTab(m_tabModemGpsConfig);
if (m_netIfConfig.getHwTypeEnum() == GwtNetIfType.LOOPBACK || m_netIfConfig.getName().startsWith("mon.wlan")) {
removeTab(m_tabDhcpNatConfig);
} else {
insertTab(m_tabDhcpNatConfig, 1);
}
}
if (includeDhcpNatTab) {
Log.debug("enable dhcp/nat tab");
m_tabDhcpNatConfig.enable();
} else {
Log.debug("disable dhcp/nat tab");
m_tabDhcpNatConfig.disable();
}
if (netIfStatus.equals(GwtNetIfStatus.netIPv4StatusDisabled)) {
Log.debug("Disabled - remove tabs");
disableInterfaceTabs();
}
if (m_netIfConfig instanceof GwtModemInterfaceConfig) {
if (!((GwtModemInterfaceConfig) m_netIfConfig).isGpsSupported()) {
Log.debug("Disable GPS tab");
m_tabModemGpsConfig.disable();
}
}
}
use of org.eclipse.kura.web.shared.model.GwtNetIfStatus in project kura by eclipse.
the class TcpIpConfigTab method refreshForm.
private void refreshForm() {
if (m_formPanel != null) {
if (m_selectNetIfConfig != null && m_selectNetIfConfig.getHwTypeEnum() == GwtNetIfType.MODEM) {
for (Field<?> field : m_formPanel.getFields()) {
field.setEnabled(false);
}
m_statusCombo.setEnabled(true);
m_dnsField.setEnabled(true);
// TODO: set value according to modem setting
m_configureCombo.setSimpleValue(MessageUtils.get(GwtNetIfConfigMode.netIPv4ConfigModeDHCP.name()));
} else {
GwtNetIfStatus statusValue = m_statusCombo.getValue().getStatus();
if (GwtNetIfStatus.netIPv4StatusDisabled.equals(statusValue)) {
// clear/reset the fields
m_configureCombo.setSimpleValue(MessageUtils.get(GwtNetIfConfigMode.netIPv4ConfigModeDHCP.name()));
m_ipAddressField.setValue("");
m_subnetMaskField.setValue("");
m_gatewayField.setValue("");
m_dnsField.setValue("");
m_domainsField.setValue("");
for (Field<?> field : m_formPanel.getFields()) {
if (field != m_statusCombo) {
field.setEnabled(false);
}
}
} else {
m_configureCombo.setEnabled(true);
String configureValue = m_configureCombo.getSimpleValue();
Log.debug("configureValue: " + configureValue);
Log.debug("MessageUtils.get(GwtNetIfConfigMode.netIPv4ConfigModeDHCP.name())): " + MessageUtils.get(GwtNetIfConfigMode.netIPv4ConfigModeDHCP.name()));
Log.debug("GwtNetIfConfigMode.netIPv4ConfigModeDHCP.name(): " + GwtNetIfConfigMode.netIPv4ConfigModeDHCP.name());
if (configureValue.equals(MessageUtils.get(GwtNetIfConfigMode.netIPv4ConfigModeDHCP.name()))) {
Log.debug("Enabling gateway field");
m_ipAddressField.setEnabled(false);
m_subnetMaskField.setEnabled(false);
m_gatewayField.setEnabled(false);
m_renewDHCPButton.setEnabled(true);
} else {
m_ipAddressField.setEnabled(true);
m_subnetMaskField.setEnabled(true);
m_gatewayField.setEnabled(true);
if (GwtNetIfStatus.netIPv4StatusEnabledWAN.equals(statusValue)) {
Log.debug("Enabling gateway field");
m_gatewayField.setEnabled(true);
} else {
Log.debug("Disabling gateway field");
m_gatewayField.setValue("");
m_gatewayField.setEnabled(false);
}
m_renewDHCPButton.setEnabled(false);
}
m_dnsField.setEnabled(true);
m_domainsField.setEnabled(true);
}
}
// Show read-only dns field when DHCP is selected and there are no custom DNS entries
String configureValue = m_configureCombo.getSimpleValue();
if (configureValue.equals(MessageUtils.get(GwtNetIfConfigMode.netIPv4ConfigModeDHCP.name())) && (m_dnsField.getValue() == null || m_dnsField.getValue().isEmpty())) {
showReadOnlyDns();
} else {
hideReadOnlyDns();
}
}
}
Aggregations