📄 verifypackageplaypenpanel.java
字号:
package org.fife.rtext.plugins.rtextl10ngen;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.text.MessageFormat;
import java.util.ResourceBundle;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.fife.RUtilities;
import org.fife.ui.app.WizardPluginDialog;
import org.fife.ui.app.WizardDialogInfoPanel;
import org.fife.ui.rtextfilechooser.RDirectoryChooser;
/**
* The panel that prompts the user to verify that they are sure they want to
* package the specified playpen.
*
* @author Robert Futrell
* @version 1.0
*/
class VerifyPackagePlaypenPanel extends WizardDialogInfoPanel {
private ResourceBundle msg;
private JPanel infoPanel;
private JLabel playpenLabel;
private JLabel zipLabel;
/*****************************************************************************/
/**
* Constructor.
*
* @param msg The plugin's resource bundle.
*/
public VerifyPackagePlaypenPanel(ResourceBundle msg) {
super(msg.getString("Plugin.Wizard.Package.Verify.Header"));
this.msg = msg;
setLayout(new BorderLayout());
JPanel contentPane = new JPanel();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
JPanel temp = new JPanel(new BorderLayout());
String desc = msg.getString("Plugin.Wizard.Package.Verify.WillDo.Desc");
temp.add(new JLabel(desc));//, BorderLayout.WEST);
contentPane.add(temp);
contentPane.add(Box.createVerticalStrut(30));
infoPanel = new JPanel(new SpringLayout());
desc = msg.getString("Plugin.Wizard.Common.PPen.Prompt");
infoPanel.add(new JLabel(desc));
playpenLabel = new JLabel("xxxxxxxxxxxxx");
infoPanel.add(playpenLabel);
desc = msg.getString("Plugin.Wizard.Package.Verify.ZipFile.Prompt");
infoPanel.add(new JLabel(desc));
zipLabel = new JLabel("xxxxxxxxxxxxx");
infoPanel.add(zipLabel);
RUtilities.makeSpringCompactGrid(infoPanel, 2,2, 0,0, 5,5);
temp = new JPanel(new BorderLayout());
temp.add(infoPanel);
contentPane.add(temp);
//contentPane.add(infoPanel);
add(contentPane, BorderLayout.NORTH);
}
/*****************************************************************************/
/**
* Called when this panel is "accepted" in the wizard (e.g., the user
* clicks "Next" and <code>validateInput</code> returns <code>null</code>).
* This method packages the specified playpen in a zip file.
*
* @see #isDisplayed
*/
public void isAccepted() {
WizardPluginDialog wiz = getWizard();
RTextL10nGenPlugin plugin = (RTextL10nGenPlugin)wiz.getPlugin();
try {
boolean rc = plugin.packagePlaypen(
(File)wiz.getWizardProperty("Playpen"),
(File)wiz.getWizardProperty("ZipFile"));
} catch (IOException ioe) {
ioe.printStackTrace();
System.exit(0); // FIXME: What to do???
}
}
/*****************************************************************************/
/**
* Called when this panel is displayed in the wizard. This gives the
* panel to do anything "extra" it wants to do, such as disable the
* "Next" button.
*/
public void isDisplayed() {
WizardPluginDialog wizard = getWizard();
File playpen = (File)wizard.getWizardProperty("Playpen");
File zipFile = new File(playpen, "i18n.zip");
wizard.setWizardProperty("ZipFile", zipFile);
playpenLabel.setText(playpen.getAbsolutePath());
zipLabel.setText(zipFile.getAbsolutePath());
// RUtilities.makeSpringCompactGrid(infoPanel, 2,2, 0,0, 5,5);
}
/*****************************************************************************/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -