Package tcg.scada.sim.iecsim.datastore

Examples of tcg.scada.sim.iecsim.datastore.DataStore


  /**
   * Show general log.
   */
  public void showGeneralLog()
  {
    DataStore ds = getActiveDataStore();
    if (ds == null)
    {
      //TODO: print out some log
      return;
    }
   
    ds.showGeneralLog();
  }
View Full Code Here


  /**
   * Show communication log.
   */
  public void showCommLog()
  {
    DataStore ds = getActiveDataStore();
    if (ds == null)
    {
      //TODO: print out some log
      return;
    }
   
    ds.showCommLog();
  }
View Full Code Here

  /**
   * Show reaction script frame.
   */
  public void showReactionScript()
  {
    DataStore ds = getActiveDataStore();
    if (ds == null)
    {
      //TODO: print out some log
      return;
    }
   
    ds.showReactionScript();
  }
View Full Code Here

//        reset = null;
//      }
//    }
    else if (message.equals("startscript"))
    {
      DataStore ds = this.getActiveDataStore();
      if (ds == null)
      {
        return;
      }
     
      ds.startScript();
      if (ds.hasRunningScript())
      {
        menu_.enableMenuItem("stopscript", true);
      }
    }
    else if (message.equals("stopscript"))
    {
      DataStore ds = this.getActiveDataStore();
      if (ds == null)
      {
        return;
      }
     
      // Open frame with list of scripts
      // Get script name and stop that script
      if (ds.hasRunningScript())
      {
        Set<String> ks = ds.getScriptList().keySet();
        Object [] listOfScripts = ks.toArray();
        String s = (String)JOptionPane.showInputDialog(
                            MainWindow.getInstance(),
                            "Select script to stop",
                            "Scripts",
                            JOptionPane.PLAIN_MESSAGE,
                            null,
                            listOfScripts,
                            (String)listOfScripts[0]);
 
        // Stop the selected script.
        if ((s != null) && (s.length() > 0))
        {
          ds.stopScript(s);
       
      }
     
      // After we stop the script, check if there is still any running scripts
      menu_.enableMenuItem("startscript", true);
      if (ds.hasRunningScript())
      {
        menu_.enableMenuItem("stopscript", true);
      }
      else
      {
        menu_.enableMenuItem("stopscript", false);
      }

    }
    else if (message.equals("cancelloadscript"))
    {
      DataStore ds = this.getActiveDataStore();
      if (ds == null)
      {
        return;
      }
     
      menu_.enableMenuItem("startscript", true);
      if (ds.hasRunningScript())
      {
        menu_.enableMenuItem("stopscript", true);
      }
      else
      {
        menu_.enableMenuItem("stopscript", false);
      }
    }


    /** Action to change settings and ports **/
    else if (message.equals("changeprimaryport"))
    {
      DataStore ds = this.getActiveDataStore();
      if (ds == null)
      {
        return;
      }
     
      int oldPort = ds.getPrimaryPort();
      String newValue = JOptionPane.showInputDialog(ds.getFrame(), str_changepport, Integer.toString(oldPort));

      //validate the input
      if (newValue != null)
      {
        try {
          int integer = Integer.parseInt(newValue);
          if (integer > 1023)
          {
            ds.changePrimaryPort(integer);
          }
          else
          {
            throw new NumberFormatException();
          }
        }
        catch (NumberFormatException nfe)
        {
          MessageBox.Error(ds.getFrame(), str_toosmall, "Error");
        }
      }
    }
    else if (message.equals("changestandbyport"))
    {
      DataStore ds = this.getActiveDataStore();
      if (ds == null)
      {
        return;
      }
     
      int oldPort = ds.getStandbyPort();
      String newValue = JOptionPane.showInputDialog(ds.getFrame(), str_changesport, Integer.toString(oldPort));

      //validate the input
      if (newValue != null)
      {
        try {
          int integer = Integer.parseInt(newValue);
          if (integer > 1023)
          {
            ds.changeStandbyPort(integer);
          }
          else
          {
            throw new NumberFormatException();
          }
        }
        catch (NumberFormatException nfe)
        {
          MessageBox.Error(ds.getFrame(), str_toosmall, "Error");
        }
      }
    }
    else if (message.equals("settings"))
    {
View Full Code Here

          if (sdeviceid == 0)
          {
            sdeviceid = pdeviceid;
          }
         
          DataStore ds = new DataStore(id, pport, sport, pdeviceid, sdeviceid);
          MainWindow.getInstance().addDataStore(ds);
        }
       
        //reset the cursor
      //optionPane_.setCursor(MainWindow.DEFAULT_CURSOR);
View Full Code Here

TOP

Related Classes of tcg.scada.sim.iecsim.datastore.DataStore

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.