Package ch.rakudave.jnetmap.net

Examples of ch.rakudave.jnetmap.net.Subnet


          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              if (netScan != null) return;
              scan.setEnabled(false);
              netScan = new NetworkScan(new Subnet(addr.getText(), sub.getText()), new ChangeListener() {
                @Override
                @SuppressWarnings("unchecked")
                public void stateChanged(ChangeEvent e) {
                  InetAddress address = ((Tuple<InetAddress, PingMethod>)e.getSource()).getFirst();
                  JCheckBox c = new JCheckBox(address.getHostAddress(), true);
View Full Code Here


    setVisible(true);
  }
 
  private void autoFill(JTextField address, JTextField subnet) {
    try {
      Subnet s = new Subnet((address.getText().contains("/"))?address.getText():address.getText()+"/24");
      address.setText(s.getInfo().getLowAddress());
      subnet.setText(s.getInfo().getNetmask());
    } catch (Exception e) {
      Logger.warn("Unable to autoFill address "+address.getText(), e);
    }
  }
View Full Code Here

  private static void autocomplete(JTextField address, JTextField subnet, JTextField gateway, boolean force) {
    try {
      // attempt auto-completion
      String addr = address.getText(), mask = subnet.getText();
      mask = (mask.isEmpty())?"255.255.255.0":mask;
      Subnet s;
      if (addr.contains("/")) s = new Subnet(addr);
      else s = new Subnet(addr, mask);
      address.setText(s.getInfo().getAddress());
      if (subnet.getText().isEmpty() || force) subnet.setText(s.getInfo().getNetmask());
      if (gateway.getText().isEmpty() || force) gateway.setText(s.getInfo().getLowAddress());
    } catch (Exception ex) {/*just trying, no harm done*/}
  }
 
View Full Code Here

  @Override
  public boolean setSubnet(String subnet) {
    if (subnet == null || subnet.isEmpty()) return false;
    if (!(subnet.contains("."))) {
      try {
        this.subnet = new Subnet(subnet);
      } catch (Exception e) {
        Logger.warn("Invalid CIDR-format for subnet " + subnet);
        return false;
      }
    } else {
      try {
        this.subnet = new Subnet(address.getHostAddress(), subnet);
      } catch (Exception e) {
        Logger.warn("Address undefined or Subnet not found: " + subnet);
        return false;
      }
    }
View Full Code Here

    return device.getStatus();
  }

  @Override
  public Subnet getSubnet() {
    if (subnet == null) subnet = new Subnet("192.168.0.1/24");
    return subnet;
  }
View Full Code Here

  @Override
  public boolean setSubnet(String subnet) {
    if (subnet == null || subnet.isEmpty()) return false;
    if (!(subnet.contains("."))) {
      try {
        this.subnet = new Subnet(subnet);
      } catch (Exception e) {
        Logger.warn("Invalid CIDR-format for subnet " + subnet);
        return false;
      }
    } else {
      try {
        this.subnet = new Subnet(address.getHostAddress(), subnet);
      } catch (Exception e) {
        Logger.warn("Address undefined or Subnet not found: " + subnet);
        return false;
      }
    }
View Full Code Here

TOP

Related Classes of ch.rakudave.jnetmap.net.Subnet

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.