📄 octopusgeneratorpanel.java
字号:
* This method check if the action is performed (event key pressed)
* @param e is event
*/
public void actionPerformed(ActionEvent e) {
main.setDividerLocation(0);
}
}
private class NormalScreenAction extends AbstractAction {
/**
* This method starts the LoaderGenerator application
*/
public NormalScreenAction() {
putValue(
SMALL_ICON,
new ImageIcon(
getClass().getClassLoader().getResource(
"org/webdocwf/util/loader/" + "wizard/images/Unhost16.gif")));
putValue(SHORT_DESCRIPTION, "Normal Screen");
putValue(LONG_DESCRIPTION, "Back to normal screen");
putValue(
ACCELERATOR_KEY,
KeyStroke.getKeyStroke(
'N',
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
putValue(MNEMONIC_KEY, new Integer('N'));
}
/**
* This method check if the action is performed (event key pressed)
* @param e is event
*/
public void actionPerformed(ActionEvent e) {
main.setDividerLocation(510);
}
}
private class SaveTraceAction extends AbstractAction {
/**
* This method starts the LoaderGenerator application
*/
public SaveTraceAction() {
putValue(
SMALL_ICON,
new ImageIcon(
getClass().getClassLoader().getResource(
"org/webdocwf/util/loader/" + "wizard/images/Save16.gif")));
putValue(SHORT_DESCRIPTION, "Save Trace");
putValue(LONG_DESCRIPTION, "Save Trace to file");
putValue(
ACCELERATOR_KEY,
KeyStroke.getKeyStroke(
'S',
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
putValue(MNEMONIC_KEY, new Integer('S'));
}
/**
* This method check if the action is performed (event key pressed)
* @param e is event
*/
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser();
fc.setDialogTitle("Save Octopus log ...");
int returnVal = fc.showSaveDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
String text = traceArea.getText();
try {
Writer out = new BufferedWriter(new FileWriter(file));
out.write(text);
out.close();
} catch (Exception ex) {
ex.printStackTrace();
}
} else {
//do nothing
}
}
}
private class ClearTraceAction extends AbstractAction {
/**
* This method starts the LoaderGenerator application
*/
public ClearTraceAction() {
putValue(
SMALL_ICON,
new ImageIcon(
getClass().getClassLoader().getResource(
"org/webdocwf/util/loader/" + "wizard/images/Delete16.gif")));
putValue(SHORT_DESCRIPTION, "Clear Trace");
putValue(LONG_DESCRIPTION, "Clear Trace");
putValue(
ACCELERATOR_KEY,
KeyStroke.getKeyStroke(
'L',
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
putValue(MNEMONIC_KEY, new Integer('L'));
}
/**
* This method check if the action is performed (event key pressed)
* @param e is event
*/
public void actionPerformed(ActionEvent e) {
traceArea.setText("");
}
}
private class BrowseAction_GO extends AbstractAction {
/**
* This method stop the LoaderGenerator application
*/
public BrowseAction_GO() {
putValue(
SMALL_ICON,
new ImageIcon(
getClass().getClassLoader().getResource(
"org/webdocwf/util/loader/" + "wizard/images/Open16.gif")));
putValue(SHORT_DESCRIPTION, "Browse for Generator output directory");
putValue(LONG_DESCRIPTION, "Browse for Generator output 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 Generator Output Directory");
chooser.setApproveButtonText("Open");
String strFieldText = "";
chooser.setCurrentDirectory(new File(strFieldText));
int v = chooser.showOpenDialog(null);
// desktop.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;
}
generatorOutput.setText(choice.getPath());
}
break;
case JFileChooser.CANCEL_OPTION :
case JFileChooser.ERROR_OPTION :
}
}
}
//log dir
private class BrowseAction_L
extends AbstractAction {
public BrowseAction_L() {
// 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(), "label");
}
break;
case JFileChooser.CANCEL_OPTION:
case JFileChooser.ERROR_OPTION:
}
}
}
//additional paths
private class BrowseAction_AC extends AbstractAction {
/**
* This method stop the LoaderGenerator application
*/
public BrowseAction_AC() {
putValue(
SMALL_ICON,
new ImageIcon(
getClass().getClassLoader().getResource(
"org/webdocwf/util/loader/" + "wizard/images/Open16.gif")));
putValue(SHORT_DESCRIPTION, "Add .jar files");
putValue(LONG_DESCRIPTION, "Add .jar (jdbc) files to system classpath");
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 JarFilter());
chooser.setDialogTitle("Select .jar file");
chooser.setAcceptAllFileFilterUsed(false);
String strFieldText = addPaths.getText();
if (!strFieldText.equalsIgnoreCase(""))
strFieldText = strFieldText + ";";
chooser.setCurrentDirectory(new File(strFieldText));
chooser.setApproveButtonText("Open");
int v = chooser.showOpenDialog(null);
// desktop.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;
}
addPaths.setText(strFieldText + choice.getPath());
}
break;
case JFileChooser.CANCEL_OPTION :
case JFileChooser.ERROR_OPTION :
chooser.removeAll();
chooser = null;
current = null;
}
}
}
//doml file
private class BrowseAction_DOML extends AbstractAction {
/**
* This method stop the LoaderGenerator application
*/
public BrowseAction_DOML() {
// putValue(NAME, "browse");
putValue(
SMALL_ICON,
new ImageIcon(
getClass().getClassLoader().getResource(
"org/webdocwf/util/loader/" + "wizard/images/Open16.gif")));
putValue(SHORT_DESCRIPTION, "Browse for .doml file");
putValue(LONG_DESCRIPTION, "Browse for .doml 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 DomlFilter());
chooser.setDialogTitle("Select .doml 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(DOML_PATH, choice.getPath(), "label");
}
break;
case JFileChooser.CANCEL_OPTION :
case JFileChooser.ERROR_OPTION :
chooser.removeAll();
chooser = null;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -