Package javax.swing

Examples of javax.swing.AbstractAction


     * Runtime.getRuntime().halt(0); return; } showState(newState); } });
     */
    ti.setImageAutoSize(true);

    final JPopupMenu popup = new JPopupMenu();
    _exitItem.setAction(new AbstractAction("Exit", createImageIcon("/resources/exit.png"))
    {
      public void actionPerformed(ActionEvent e)
      {
        popup.setVisible(false);
        stop = true;
        synchronized (tray)
        {
          tray.remove(ti);
        }
      }

    });
    _stopItem.setAction(new AbstractAction("Stop", createImageIcon("/resources/stop.png"))
    {
      public void actionPerformed(ActionEvent e)
      {
        executor.execute(new Runnable()
        {

          public void run()
          {
            if (_process != null)
              try
              {
                _process.stop();
              }
              catch (Throwable ex)
              {
                ex.printStackTrace();
              }
          }

        });
        popup.setVisible(false);
      }

    });
    _closeItem.setAction(new AbstractAction("Close Popup", createImageIcon("/resources/close.png"))
    {
      public void actionPerformed(ActionEvent e)
      {
        popup.setVisible(false);
      }
    });

    _startItem.setAction(new AbstractAction("Start", createImageIcon("/resources/start.png"))
    {
      public void actionPerformed(ActionEvent e)
      {
        if (_process != null)
          try
          {
            _process.start();
          }
          catch (Throwable ex)
          {
            ex.printStackTrace();
          }
        popup.setVisible(false);
      }
    });
    _restartItem.setAction(new AbstractAction("Restart", createImageIcon("/resources/restart.png"))
    {
      public void actionPerformed(ActionEvent e)
      {
        if (_process != null)
          try
          {
            _process.restart();
          }
          catch (Throwable ex)
          {
            ex.printStackTrace();
          }

        popup.setVisible(false);
      }

    });
    _consoleItem.setAction(new AbstractAction("Console", createImageIcon("/resources/console.png"))
    {
      public void actionPerformed(ActionEvent e)
      {
        if (_process != null)
          openConsole();
        popup.setVisible(false);
      }

    });
    _threadDumpItem.setAction(new AbstractAction("Thread Dump", createImageIcon("/resources/lightning.png"))
    {
      public void actionPerformed(ActionEvent e)
      {
        if (_process != null)
          try
          {
            _process.threadDump();
          }
          catch (Throwable ex)
          {
            ex.printStackTrace();
          }

        popup.setVisible(false);
      }
    });

    _stopTimerItem.setAction(new AbstractAction("Stop Timer/Condition", createImageIcon("/resources/clock_stop.png"))
    {
      public void actionPerformed(ActionEvent e)
      {
        if (_process != null)
        {
          try
          {
            _process.stopTimerCondition();
            if (_console != null)
            {
              _console.setTimer(_process.isTimerActive());
              _console.setCondition(_process.isConditionActive());
            }
          }
          catch (Throwable ex)
          {
            ex.printStackTrace();
          }

        }
        popup.setVisible(false);
      }
    });
    _exitWrapperItem.setAction(new AbstractAction("Stop Wrapper", createImageIcon("/resources/exitWrapper.png"))
    {
      public void actionPerformed(ActionEvent e)
      {
        executor.execute(new Runnable()
        {
          public void run()
          {
            if (_process != null)
              try
              {
                _process.stopWrapper();
              }
              catch (Throwable ex)
              {
                ex.printStackTrace();
              }

          }
        });
        popup.setVisible(false);
      }

    });

    _threadDumpWrapperItem.setAction(new AbstractAction("TDump Wrapper", createImageIcon("/resources/lightning.png"))
    {
      public void actionPerformed(ActionEvent e)
      {
        if (_process != null)
          try
          {
            _process.wrapperThreadDump();
          }
          catch (Throwable ex)
          {
            ex.printStackTrace();
          }

        popup.setVisible(false);
      }

    });

    _closeConsoleItem.setAction(new AbstractAction("Close Console")
    {
      public void actionPerformed(ActionEvent e)
      {
        closeConsole();
        popup.setVisible(false);
      }

    });

    _startServiceItem.setAction(new AbstractAction("Start Service", createImageIcon("/resources/startService.png"))
    {
      public void actionPerformed(ActionEvent e)
      {
        if (_process == null)
        {
          try
          {
            WrappedService w = new WrappedService();
            w.init();
            w.start();
          }
          catch (Throwable ex)
          {
            ex.printStackTrace();
          }

        }
        popup.setVisible(false);
      }

    });

    _responseItem.setAction(new AbstractAction("Response", createImageIcon("/resources/Help16.gif"))
    {
      public void actionPerformed(ActionEvent e)
      {
        if (_process != null && _inquireMessage != null)
        {
View Full Code Here


      }
       
      }, 0, 500);


      form._NEW_HOST_BUTTON.setAction(new AbstractAction("+")
      {
      public void actionPerformed(ActionEvent e)
      {
        doNewHost();
      }       
      });
     

      form._DELETE_HOST_BUTTON.setAction(new AbstractAction("-")
      {
      public void actionPerformed(ActionEvent e)
      {
        doDeleteHost();
      }       
      });
     

     
      form._ADD_HOSTS_BUTTON.setAction(new AbstractAction(">>")
      {
      public void actionPerformed(ActionEvent e)
      {
        for (Host host : hosts.getSelection())
        {
          Host newHost = new Host(host.getName(), host.getPort());
          newHost.setState(host.getState());
          newHost.setIncluded(true);
          hosts.updateObject(newHost);
          servicesTable.addService(host.getName(), proxies.get(host.getName()));
        }
        saveData();
      }       
      });
     
      form._REMOVE_HOSTS_BUTTON.setAction(new AbstractAction("<<")
      {
      public void actionPerformed(ActionEvent e)
      {
        for (Host host : hosts.getSelection())
        {
          Host newHost = new Host(host.getName(), host.getPort());
          newHost.setState(host.getState());
          newHost.setIncluded(false);
          hosts.updateObject(newHost);
          servicesTable.removeService(host.getName());
        }
        saveData();
      }       
      });
     
      form._ADD_HIDDEN_BUTTON.setAction(new AbstractAction("<<")
      {
      public void actionPerformed(ActionEvent e)
      {
        for (ServiceInfo service : servicesTable.getSelection())
        {
          hidden.updateObject(service);
        }
        saveData();
      }       
      });
     
      form._REMOVE_HIDDEN_BUTTON.setAction(new AbstractAction(">>")
      {
      public void actionPerformed(ActionEvent e)
      {
        for (ServiceInfo service : hidden.getSelection())
        {
          hidden.removeObject(service);
        }
        saveData();
      }       
      });
     

      form._START_BUTTON.setAction(new AbstractAction("Start")
      {
      public void actionPerformed(ActionEvent e)
      {
        for (ServiceInfo service : servicesTable.getSelection())
        try {
          proxies.get(service.getHost()).start(service.getName());
        }
        catch (Exception ex)
        {
          ex.printStackTrace();
        }
      }       
      });
     
      form._STOP_BUTTON.setAction(new AbstractAction("Stop")
      {
      public void actionPerformed(ActionEvent e)
      {
        for (ServiceInfo service : servicesTable.getSelection())
        try {
          proxies.get(service.getHost()).stop(service.getName());
        }
        catch (Exception ex)
        {
          ex.printStackTrace();
        }
      }       
      });
     
      form._INSTALL_BUTTON.setAction(new AbstractAction("Install")
      {
      public void actionPerformed(ActionEvent e)
      {
        doInstall();
      }       
      });
     
      form._UNINSTALL_BUTTON.setAction(new AbstractAction("Uninstall")
      {
      public void actionPerformed(ActionEvent e)
      {
        doUninstall();
      }       
      });
     
      form._RELOAD_CONSOLE.setAction(new AbstractAction("Reload Console App")
      {
      public void actionPerformed(ActionEvent e)
      {
        doReloadConsole();
      }       
View Full Code Here

  {
    final NewHostDialog newDialog = new NewHostDialog();
   
      final JDialog dialog = new JDialog(frame);
      final Vector<String> listData = new Vector<String>();
      newDialog._OK_BUTTON.setAction(new AbstractAction("ADD")
      {

      public void actionPerformed(ActionEvent e)
      {
        String name = newDialog._HOST.getText();
        String stPort = newDialog._PORT.getText();
        if (name == null || name.length() == 0 || stPort == null || stPort.length() == 0)
          return;
        try
        {
        int port = Integer.parseInt(stPort);
        synchronized(hosts)
        {
        hosts.updateObject(new Host(name, port));
          saveData();
        }
        }
        catch (Exception ex)
        {
          ex.printStackTrace();
        }
      }
       
      });
      newDialog._CANCEL_BUTTON.setAction(new AbstractAction("CLOSE")
      {

      public void actionPerformed(ActionEvent e)
      {
        dialog.setVisible(false);
View Full Code Here

      for (ServiceInfo info : selected)
      {
        uninstall._SERVICES.setText(uninstall._SERVICES.getText()+info.getHost()+"/"+info.getDisplayName()+ " ");
      }

      uninstall._OK_BUTTON.setAction(new AbstractAction("UNINSTALL")
      {

      public void actionPerformed(ActionEvent e)
      {
        uninstall._OK_BUTTON.setEnabled(false);
        uninstall._SERVICES.setText("");
            for (ServiceInfo info : selected)
            {
            AsyncServiceManagerServer proxy = proxies.get(info.getHost());
            if (proxy != null)
            {
              boolean result = false;
            try
            {
              result = ((Boolean) ((Future)proxy.yajswUninstall(info.getName())).get(10, TimeUnit.SECONDS)).booleanValue();
            }
            catch (Exception e1)
            {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
              if (result)
                uninstall._SERVICES.setText(uninstall._SERVICES.getText() + "success");
              else
                uninstall._SERVICES.setText(uninstall._SERVICES.getText() + "error");
            }
            else
              uninstall._SERVICES.setText(uninstall._SERVICES.getText() + "no connection");
             
          }
           
      }
       
      });
      uninstall._CANCEL_BUTTON.setAction(new AbstractAction("CLOSE")
      {

      public void actionPerformed(ActionEvent e)
      {
        dialog.setVisible(false);
View Full Code Here

        return;
      final ServiceInfo selected = servicesTable.getSelection().get(0);
      reloadConsole._SERVICE.setText(selected.getName());
      reloadConsole._CONFIGURATION.setModel(new DefaultComboBoxModel(new Vector(configurations)));

      reloadConsole._OK_BUTTON.setAction(new AbstractAction("Reload")
      {

      public void actionPerformed(ActionEvent e)
      {
        reloadConsole._OK_BUTTON.setEnabled(false);
          AsyncServiceManagerServer proxy = proxies.get(selected.getHost());
        boolean result = false;
        try
        {
          result = ((Boolean)((Future)proxy.yajswReloadConsole(selected.getName(), (String) reloadConsole._CONFIGURATION.getSelectedItem())).get(10, TimeUnit.SECONDS)).booleanValue();
        }
        catch (Exception e1)
        {
          // TODO Auto-generated catch block
          e1.printStackTrace();
        }
        if (result)
          reloadConsole._MESSAGE.setText("success");
        else
          reloadConsole._MESSAGE.setText("error");
          if (!configurations.contains(reloadConsole._CONFIGURATION.getSelectedItem()))
          {
            configurations.add((String) reloadConsole._CONFIGURATION.getSelectedItem());
            saveData();
          }             
      }
       
      });
      reloadConsole._CANCEL_BUTTON.setAction(new AbstractAction("CLOSE")
      {

      public void actionPerformed(ActionEvent e)
      {
        dialog.setVisible(false);
View Full Code Here

      if (selected.size() >0)
      {
        ServiceInfo selection = selected.get(0);
      }
    install._CONFIGURATION.setModel(new DefaultComboBoxModel(new Vector(configurations)));
      install._OK_BUTTON.setAction(new AbstractAction("INSTALL")
      {

      public void actionPerformed(ActionEvent e)
      {
          int[] selInd = install._HOSTS_LIST.getSelectedIndices();
          install._OK_BUTTON.setEnabled(false);
          install._MESSAGE.setText("installing");
          for (int i : selInd)
          {
            install._MESSAGE.setText(install._MESSAGE.getText()+ " - " + listData.get(i) + ": ");
            AsyncServiceManagerServer proxy = proxies.get(listData.get(i));
            if (proxy != null)
            {
              boolean result = false;
            try
            {
              result = ((Boolean)((Future)proxy.yajswInstall((String) install._CONFIGURATION.getSelectedItem())).get(10, TimeUnit.SECONDS)).booleanValue();
            }
            catch (Exception e1)
            {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
              if (result)
                install._MESSAGE.setText(install._MESSAGE.getText() + "success");
              else
                install._MESSAGE.setText(install._MESSAGE.getText() + "error");
            }
            else
                install._MESSAGE.setText(install._MESSAGE.getText() + "no connection");
            if (!configurations.contains(install._CONFIGURATION.getSelectedItem()))
            {
              configurations.add((String) install._CONFIGURATION.getSelectedItem());
            }             
          }
          saveData();
      }
       
      });
      install._CANCEL_BUTTON.setAction(new AbstractAction("CLOSE")
      {

      public void actionPerformed(ActionEvent e)
      {
        dialog.setVisible(false);
View Full Code Here

  /**
   * This creates a new MessageLoader from a FolderInfo object.
   */
  public MessageLoader(FolderInfo newFolderInfo) {
    folderInfo = newFolderInfo;
    mAction = new AbstractAction("Load Messages - " + newFolderInfo.getFolderID()) {
  public void actionPerformed(ActionEvent ae) {
    loadNextBatch();
  }
      };
  }
View Full Code Here

        final FolderInfo fi = mailServer.getOutbox();

        if (fi != null) {
          net.suberic.util.thread.ActionThread folderThread = fi.getFolderThread();
          Action runMe = new AbstractAction() {
              public void actionPerformed(java.awt.event.ActionEvent e) {
                try {
                  getNewMessageInfo().saveDraft(fi, profile, headers, messageText, messageContentType);
                  saveDraftSucceeded(fi);
                } catch (OperationCancelledException oce) {
View Full Code Here

                ImporterUI ui = importController.getImportController().getUI(dbb.buildImporter());
                String menuName = dbb.getName();
                if (ui != null) {
                    menuName = ui.getDisplayName();
                }
                JMenuItem menuItem = new JMenuItem(new AbstractAction(menuName) {

                    public void actionPerformed(ActionEvent e) {
                        importController.importDatabase(dbb.buildImporter());
                    }
                });
View Full Code Here

        final GeneratorController generatorController = Lookup.getDefault().lookup(GeneratorController.class);
        if (generatorController != null) {
            for (final Generator gen : generatorController.getGenerators()) {
                String menuName = gen.getName() + "...";
                JMenuItem menuItem = new JMenuItem(new AbstractAction(menuName) {

                    public void actionPerformed(ActionEvent e) {
                        generatorController.generate(gen);
                    }
                });
View Full Code Here

TOP

Related Classes of javax.swing.AbstractAction

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.