コード例 #1
0
  private void refreshForm() {

    if (m_formPanel != null) {
      if (!m_tcpIpConfigTab.isLanEnabled()) {
        for (Field<?> field : m_formPanel.getFields()) {
          field.setEnabled(false);
        }
      } else {
        GwtWifiWirelessMode wirelessMode = m_wirelessConfigTab.getWirelessMode();
        if (m_selectNetIfConfig.getHwTypeEnum() == GwtNetIfType.WIFI
            && (wirelessMode == GwtWifiWirelessMode.netWifiWirelessModeStation
                || wirelessMode == GwtWifiWirelessMode.netWifiWirelessModeDisabled)) {
          for (Field<?> field : m_formPanel.getFields()) {
            field.setEnabled(false);
          }
        } else {

          for (Field<?> field : m_formPanel.getFields()) {
            field.setEnabled(true);
            field.validate();
          }
          String modeValue = m_modeCombo.getValue().getValue();
          if (modeValue == MessageUtils.get(GwtNetRouterMode.netRouterNat.name())
              || modeValue == MessageUtils.get(GwtNetRouterMode.netRouterOff.name())) {
            for (Field<?> field : m_formPanel.getFields()) {
              if (field != m_modeCombo) {
                field.setEnabled(false);
              }
            }
          } else {
            for (Field<?> field : m_formPanel.getFields()) {
              if (field != m_modeCombo) {
                field.setEnabled(true);
              }
            }
          }
        }
      }
    }
  }
コード例 #2
0
  public void setNetInterface(GwtNetInterfaceConfig netIfConfig) {
    m_dirty = true;
    m_selectNetIfConfig = netIfConfig;

    Log.debug(
        "got new netIfConfig for DHCP server for "
            + netIfConfig.getName()
            + ": "
            + "\n\t\trouter mode: "
            + netIfConfig.getRouterMode()
            + "\n\t\trouter DHCP start address: "
            + netIfConfig.getRouterDhcpBeginAddress()
            + "\n\t\trouter DHCP end address: "
            + netIfConfig.getRouterDhcpEndAddress()
            + "\n\t\trouter default lease: "
            + Integer.toString(netIfConfig.getRouterDhcpDefaultLease())
            + "\n\t\trouter max lease: "
            + Integer.toString(netIfConfig.getRouterDhcpMaxLease())
            + "\n\t\trouter Pass DNS: "
            + Boolean.toString(netIfConfig.getRouterDnsPass()));
  }
コード例 #3
0
  public void getUpdatedNetInterface(GwtNetInterfaceConfig updatedNetIf) {
    if (m_formPanel != null) {
      String modeValue = m_modeCombo.getValue().getValue();
      for (GwtNetRouterMode mode : GwtNetRouterMode.values()) {
        Log.info("Possible Mode: " + mode.name() + " with util: " + MessageUtils.get(mode.name()));
        if (MessageUtils.get(mode.name()).equals(modeValue)) {
          updatedNetIf.setRouterMode(mode.name());
        }
      }
      Log.info("Mode Value: " + modeValue);

      updatedNetIf.setRouterDhcpBeginAddress(m_dhcpBeginAddressField.getValue());
      updatedNetIf.setRouterDhcpEndAddress(m_dhcpEndAddressField.getValue());
      updatedNetIf.setRouterDhcpSubnetMask(m_dhcpSubnetMaskField.getValue());
      if (m_dhcpLeaseDefaultField.getValue() != null) {
        updatedNetIf.setRouterDhcpDefaultLease(m_dhcpLeaseDefaultField.getValue().intValue());
      }
      if (m_dhcpLeaseMaxField.getValue() != null) {
        updatedNetIf.setRouterDhcpMaxLease(m_dhcpLeaseMaxField.getValue().intValue());
      }
      updatedNetIf.setRouterDnsPass(m_passDnsRadioTrue.getValue());
    }
  }
コード例 #4
0
  private void update() {
    if (m_selectNetIfConfig != null) {
      Log.debug(
          "in update(): got new netIfConfig for DHCP server for "
              + m_selectNetIfConfig.getName()
              + ": "
              + "\n\t\trouter mode: "
              + m_selectNetIfConfig.getRouterMode()
              + "\n\t\trouter DHCP start address: "
              + m_selectNetIfConfig.getRouterDhcpBeginAddress()
              + "\n\t\trouter DHCP end address: "
              + m_selectNetIfConfig.getRouterDhcpEndAddress()
              + "\n\t\trouter default lease: "
              + Integer.toString(m_selectNetIfConfig.getRouterDhcpDefaultLease())
              + "\n\t\trouter max lease: "
              + Integer.toString(m_selectNetIfConfig.getRouterDhcpMaxLease())
              + "\n\t\trouter Pass DNS: "
              + Boolean.toString(m_selectNetIfConfig.getRouterDnsPass()));

      m_modeCombo.setSimpleValue(MessageUtils.get(m_selectNetIfConfig.getRouterMode()));
      m_modeCombo.setOriginalValue(m_modeCombo.getValue());

      m_dhcpBeginAddressField.setValue(m_selectNetIfConfig.getRouterDhcpBeginAddress());
      m_dhcpBeginAddressField.setOriginalValue(m_dhcpBeginAddressField.getValue());

      m_dhcpEndAddressField.setValue(m_selectNetIfConfig.getRouterDhcpEndAddress());
      m_dhcpEndAddressField.setOriginalValue(m_dhcpEndAddressField.getValue());

      m_dhcpSubnetMaskField.setValue(m_selectNetIfConfig.getRouterDhcpSubnetMask());
      m_dhcpSubnetMaskField.setOriginalValue(m_dhcpSubnetMaskField.getValue());

      m_dhcpLeaseDefaultField.setValue(m_selectNetIfConfig.getRouterDhcpDefaultLease());
      m_dhcpLeaseDefaultField.setOriginalValue(m_dhcpLeaseDefaultField.getValue());

      m_dhcpLeaseMaxField.setValue(m_selectNetIfConfig.getRouterDhcpMaxLease());
      m_dhcpLeaseMaxField.setOriginalValue(m_dhcpLeaseMaxField.getValue());

      if (m_selectNetIfConfig.getRouterDnsPass()) {
        m_passDnsRadioTrue.setValue(true);
        m_passDnsRadioTrue.setOriginalValue(m_passDnsRadioTrue.getValue());

        m_passDnsRadioFalse.setValue(false);
        m_passDnsRadioFalse.setOriginalValue(m_passDnsRadioFalse.getValue());

        m_passDnsRadioGroup.setOriginalValue(m_passDnsRadioTrue);
        m_passDnsRadioGroup.setValue(m_passDnsRadioGroup.getValue());
      } else {
        m_passDnsRadioTrue.setValue(false);
        m_passDnsRadioTrue.setOriginalValue(m_passDnsRadioTrue.getValue());

        m_passDnsRadioFalse.setValue(true);
        m_passDnsRadioFalse.setOriginalValue(m_passDnsRadioFalse.getValue());

        m_passDnsRadioGroup.setOriginalValue(m_passDnsRadioFalse);
        m_passDnsRadioGroup.setValue(m_passDnsRadioGroup.getValue());
      }
    } else {
      Log.debug("selected Network Interface Config is null");
    }

    for (Field<?> field : m_formPanel.getFields()) {
      FormUtils.removeDirtyFieldIcon(field);
    }

    refreshForm();
  }
コード例 #5
0
 public void disableDhcpNat() {
   m_selectNetIfConfig.setRouterMode(GwtNetRouterMode.netRouterOff.name());
 }