⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 octopusloaderpanel.java

📁 数据仓库工具
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    public void actionPerformed(ActionEvent e) {
      JFileChooser chooser = null;
      File choice = null;
      File current = new File(System.getProperty("user.dir"));
      chooser = new JFileChooser(current);
      chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
      chooser.setFileFilter((javax.swing.filechooser.FileFilter)new JarFilter());
      chooser.setDialogTitle("Select .jar file");
      chooser.setAcceptAllFileFilterUsed(false);
      String strFieldText = additionalPath.getText();
//
      if(!strFieldText.equalsIgnoreCase(""))
        strFieldText = strFieldText + ";";

      chooser.setCurrentDirectory(new File(strFieldText));
      chooser.setApproveButtonText("Open");
      int v = chooser.showOpenDialog(null);

      switch(v) {
        case JFileChooser.APPROVE_OPTION:
          if(chooser.getSelectedFile() != null) {
            if(chooser.getSelectedFile().exists()) {
              choice = chooser.getSelectedFile();
            } else {
              File parentFile = new File(chooser.getSelectedFile().getParent());
              choice = parentFile;
            }
            additionalPath.setText(strFieldText + choice.getPath());
          }
          break;

        case JFileChooser.CANCEL_OPTION:
        case JFileChooser.ERROR_OPTION:

          chooser.removeAll();
          chooser = null;
          current = null;

      }
    }
  }



  private class OctopusHelpAction
      extends AbstractAction {

    /**
     * Action which creates new help frame
     */
    public OctopusHelpAction() {
      putValue(NAME, "Help");
      putValue(SMALL_ICON,
          new ImageIcon(getClass().getClassLoader().getResource("org/webdocwf/util/loader/" +
          "wizard/images/Help16.gif")));
      putValue(SHORT_DESCRIPTION, "Help for running the program");
      putValue(LONG_DESCRIPTION, "Help for running the program");
      putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('H',
          Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
      putValue(MNEMONIC_KEY, new Integer('H'));
    }

    /**
     * Creating event for new windows help frame
     * @param e is creating events
     */
    public void actionPerformed(ActionEvent e) {
      try {
        OctopusGeneratorHelpFrame helpFrame = new OctopusGeneratorHelpFrame();
        helpFrame.setIconImage(new ImageIcon(getClass().getClassLoader().getResource(
            "org/webdocwf/util/loader/" +
            "wizard/images/Enhydra16.gif")).getImage());
        helpFrame.setVisible(true);
      }
      catch(Exception ex) {
			String message = "Error while creating action for OctopusHelp button. Message : "+ex.getMessage();
			JOptionPane.showMessageDialog(null, message + "\n", "Error", 0);
			System.exit(0);
      }
    }
  }


  //log dir
  private class BrowseAction_LD
      extends AbstractAction {

    /**
     * This method stop the LoaderGenerator application
     */
    public BrowseAction_LD() {
//      putValue(NAME, "browse");
      putValue(SMALL_ICON,
          new ImageIcon(getClass().getClassLoader().
          getResource("org/webdocwf/util/loader/" +
          "wizard/images/Open16.gif")));
      putValue(SHORT_DESCRIPTION, "Browse for Log file directory");
      putValue(LONG_DESCRIPTION, "Browse for Log file directory");
      putValue(MNEMONIC_KEY, new Integer('B'));
    }

    /**
     * This method check if the action is performed (event key pressed)
     * @param e is event
     */
    public void actionPerformed(ActionEvent e) {
      JFileChooser chooser = null;
      File choice = null;
      File current = new File(System.getProperty("user.dir"));
      chooser = new JFileChooser(current);
      chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
      chooser.setFileFilter((javax.swing.filechooser.FileFilter)new DirectoryFilter());
      chooser.setDialogTitle("Select Log File Directory");
      chooser.setApproveButtonText("Open");
      String strFieldText = "";

      chooser.setCurrentDirectory(new File(strFieldText));
      int v = chooser.showOpenDialog(null);
//      parent.requestFocus();

      switch(v) {
        case JFileChooser.APPROVE_OPTION:
          if(chooser.getSelectedFile() != null) {
            if(chooser.getSelectedFile().exists()) {
              choice = chooser.getSelectedFile();
            } else {
              File parentFile = new File(chooser.getSelectedFile().getParent());
              choice = parentFile;
            }
            setField(LOG_FILE_DIRECTORY, choice.getPath(), "textfield");
          }
          break;

        case JFileChooser.CANCEL_OPTION:
        case JFileChooser.ERROR_OPTION:

      }
    }
  }

  private class BrowseAction_XML
      extends AbstractAction {

    /**
     * This method stop the LoaderGenerator application
     */
    public BrowseAction_XML() {
//      putValue(NAME, "browse");
      putValue(SMALL_ICON,
          new ImageIcon(getClass().getClassLoader().
          getResource("org/webdocwf/util/loader/" +
          "wizard/images/Open16.gif")));
      putValue(SHORT_DESCRIPTION, "Browse for .xml file");
      putValue(LONG_DESCRIPTION, "Browse for .xml file");
      putValue(MNEMONIC_KEY, new Integer('B'));
    }

    /**
     * This method check if the action is performed (event key pressed)
     * @param e is event
     */
    public void actionPerformed(ActionEvent e) {
      JFileChooser chooser = null;
      File choice = null;
      File current = new File(System.getProperty("user.dir"));
      chooser = new JFileChooser(current);
      chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
      chooser.setFileFilter((javax.swing.filechooser.FileFilter)new XmlFilter());
      chooser.setDialogTitle("Select .xml file");
      chooser.setAcceptAllFileFilterUsed(false);
      String strFieldText = "";

      chooser.setCurrentDirectory(new File(strFieldText));
      chooser.setApproveButtonText("Open");
      int v = chooser.showOpenDialog(null);

//      parent.requestFocus();
      switch(v) {
        case JFileChooser.APPROVE_OPTION:
          if(chooser.getSelectedFile() != null) {
            if(chooser.getSelectedFile().exists()) {
              choice = chooser.getSelectedFile();
            } else {
              File parentFile = new File(chooser.getSelectedFile().getParent());
              choice = parentFile;
            }
            setField(VENDOR_CONF_FILE, choice.getPath(), "textfield");
          }
          break;

        case JFileChooser.CANCEL_OPTION:
        case JFileChooser.ERROR_OPTION:

          chooser.removeAll();
          chooser = null;
          current = null;
      }
    }
  }

  private class BrowseAction_OLJ
      extends AbstractAction {

    /**
     * This method stop the LoaderGenerator application
     */
    public BrowseAction_OLJ() {
//      putValue(NAME, "browse");
      putValue(SMALL_ICON,
          new ImageIcon(getClass().getClassLoader().
          getResource("org/webdocwf/util/loader/" +
          "wizard/images/Open16.gif")));
      putValue(SHORT_DESCRIPTION, "Browse for LoaderJob.olj file");
      putValue(LONG_DESCRIPTION, "Browse for LoaderJob.olj file");
      putValue(MNEMONIC_KEY, new Integer('B'));
    }

    /**
     * This method check if the action is performed (event key pressed)
     * @param e is event
     */
    public void actionPerformed(ActionEvent e) {
      JFileChooser chooser = null;
      File choice = null;
      File current = new File(System.getProperty("user.dir"));
      chooser = new JFileChooser(current);
      chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
      chooser.setFileFilter((javax.swing.filechooser.FileFilter)new OctopusFileFilter());
      chooser.setDialogTitle("Select .olj file");
      chooser.setAcceptAllFileFilterUsed(false);
      String strFieldText = "";

      chooser.setCurrentDirectory(new File(strFieldText));
      chooser.setApproveButtonText("Open");
      int v = chooser.showOpenDialog(null);

//      parent.requestFocus();
      switch(v) {
        case JFileChooser.APPROVE_OPTION:
          if(chooser.getSelectedFile() != null) {
            if(chooser.getSelectedFile().exists()) {
              choice = chooser.getSelectedFile();
            } else {
              File parentFile = new File(chooser.getSelectedFile().getParent());
              choice = parentFile;
            }
            setField(PATH_TO_XML_FILE, choice.getPath(), "textfield");
          }
          break;

        case JFileChooser.CANCEL_OPTION:
        case JFileChooser.ERROR_OPTION:

          chooser.removeAll();
          chooser = null;
          current = null;

      }
    }
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -