home *** CD-ROM | disk | FTP | other *** search
- package sun.activator.panel;
-
- import com.sun.java.swing.BorderFactory;
- import com.sun.java.swing.Box;
- import com.sun.java.swing.BoxLayout;
- import com.sun.java.swing.ImageIcon;
- import com.sun.java.swing.JCheckBox;
- import com.sun.java.swing.JComboBox;
- import com.sun.java.swing.JComponent;
- import com.sun.java.swing.JLabel;
- import com.sun.java.swing.JPanel;
- import com.sun.java.swing.JTextField;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.KeyEvent;
- import java.awt.event.KeyListener;
- import java.util.EventObject;
-
- public class AdvancedPanel extends ActivatorSubPanel implements ActionListener, KeyListener {
- private static boolean hideJITBox;
- private static boolean hideDebugBox;
- private JCheckBox debugButton;
- private JCheckBox jitButton;
- private JTextField debugPort;
- private JLabel debugPortLabel;
- private JLabel jitPathLabel;
- private JTextField jdkPath;
- private JTextField jitPath;
- private JComboBox jdkInstalled;
- private final String otherJDK = "Other... ";
- private JLabel pathLabel;
-
- AdvancedPanel(ResourceLoader var1, ConfigurationInfo var2) {
- super(var1, var2);
- ImageIcon var3 = var1.loadImageIcon("images/WebSpice/bulb1.gif", "dim light bulb");
- ImageIcon var4 = var1.loadImageIcon("images/WebSpice/bulb2.gif", "lit light bulb");
- ImageIcon var5 = var1.loadImageIcon("images/WebSpice/bulb3.gif", "greyed out light bulb");
- JPanel var6 = new JPanel();
- ((JComponent)var6).setBorder(BorderFactory.createTitledBorder("Java Run Time Environment"));
- JPanel var7 = new JPanel();
- ((Container)var7).setLayout(new BoxLayout(var7, 0));
- ((Container)var7).add(Box.createRigidArea(new Dimension(10, 1)));
- ((Container)var6).setLayout(new BoxLayout(var6, 0));
- ((Container)var6).add(var7);
- ((Container)var6).add(Box.createRigidArea(new Dimension(10, 1)));
- this.jdkInstalled = new JComboBox();
- if (this.setInstalledJavaList()) {
- this.jdkInstalled.addActionListener(this);
- ((Container)var6).add(Box.createRigidArea(new Dimension(1, 5)));
- ((Container)var6).add(this.jdkInstalled);
- }
-
- ((Container)var6).add(Box.createRigidArea(new Dimension(1, 5)));
- ((Container)this).setLayout(new BoxLayout(this, 1));
- ((Container)this).add(Box.createRigidArea(new Dimension(1, 5)));
- ((Container)this).add(var6);
- ((Container)this).add(Box.createRigidArea(new Dimension(1, 5)));
- JPanel var8 = new JPanel();
- ((Container)var8).setLayout(new BoxLayout(var8, 0));
- this.pathLabel = new JLabel("Path : ");
- ((Container)var8).add(this.pathLabel);
- this.jdkPath = new JTextField();
- this.jdkPath.addKeyListener(this);
- ((Container)var8).add(this.jdkPath);
- ((Container)var6).setLayout(new BoxLayout(var6, 1));
- ((Container)var6).add(var8);
- JPanel var9 = new JPanel();
- this.jitButton = new JCheckBox("Enable Just In Time Compiler");
- this.jitButton.addActionListener(this);
- ((Container)var9).add(this.jitButton);
- ((Container)var9).add(Box.createRigidArea(new Dimension(5, 1)));
- this.jitPathLabel = new JLabel("JIT path");
- ((Container)var9).add(this.jitPathLabel);
- this.jitPath = new JTextField(var2.getJITPath(), 8);
- this.jitPath.setAlignmentX(0.0F);
- this.jitPath.setMaximumSize(this.jitPath.getPreferredSize());
- this.jitPath.addKeyListener(this);
- ((Container)var9).add(this.jitPath);
- if (!hideJITBox) {
- ((Container)var6).add(Box.createRigidArea(new Dimension(1, 5)));
- ((Container)var6).add(var9);
- }
-
- this.debugButton = new JCheckBox("Enable Debug", var3);
- this.debugButton.setSelectedIcon(var4);
- this.debugButton.setDisabledIcon(var5);
- this.debugButton.addActionListener(this);
- JPanel var10 = new JPanel();
- ((JComponent)var10).setBorder(BorderFactory.createTitledBorder("Debug Settings"));
- ((Container)var10).add(this.debugButton);
- this.debugPortLabel = new JLabel("Debug Port :");
- ((Container)var10).add(this.debugPortLabel);
- ((Container)var10).add(Box.createRigidArea(new Dimension(5, 1)));
- this.debugPort = new JTextField("2502", 6);
- this.debugPort.setAlignmentX(0.0F);
- this.debugPort.setMaximumSize(this.debugPort.getPreferredSize());
- this.debugPort.addKeyListener(this);
- ((Container)var10).add(this.debugPort);
- if (!hideDebugBox) {
- ((Container)this).add(Box.createRigidArea(new Dimension(1, 5)));
- ((Container)this).add(var10);
- }
-
- this.reset();
- }
-
- public void actionPerformed(ActionEvent var1) {
- if (((EventObject)var1).getSource() == this.debugButton) {
- this.debugPort.setEnabled(this.debugButton.isSelected());
- this.debugPortLabel.setEnabled(this.debugButton.isSelected());
- this.debugPort.repaint();
- this.debugPortLabel.repaint();
- super.model.setDebugEnabled(this.debugButton.isSelected());
- }
-
- if (((EventObject)var1).getSource() == this.jdkInstalled) {
- String var2 = (String)this.jdkInstalled.getSelectedItem();
- if (var2 == null) {
- return;
- }
-
- if (var2.equals("Other... ")) {
- var2 = this.jdkPath.getText();
- }
-
- if (!var2.equals(super.model.getJDK())) {
- super.model.setJDK(var2);
- this.reset();
- }
- }
-
- if (((EventObject)var1).getSource() == this.jitButton) {
- boolean var3 = this.jitButton.isSelected();
- this.jitPathLabel.setEnabled(var3);
- this.jitPath.setEnabled(var3);
- this.jitPath.repaint();
- this.jitPathLabel.repaint();
- super.model.setJITEnabled(var3);
- }
-
- }
-
- public void keyPressed(KeyEvent var1) {
- }
-
- public void keyReleased(KeyEvent var1) {
- this.keyTyped(var1);
- }
-
- public void keyTyped(KeyEvent var1) {
- if (((EventObject)var1).getSource() == this.debugPort) {
- super.model.setDebugPort(this.debugPort.getText());
- } else if (((EventObject)var1).getSource() == this.jdkPath) {
- super.model.setJDK(this.jdkPath.getText());
- } else if (((EventObject)var1).getSource() == this.jitPath) {
- if (this.jitPath.getText().length() != 0) {
- super.model.setJITPath(this.jitPath.getText());
- } else {
- super.model.setJITPath((String)null);
- }
- }
-
- }
-
- public void reset() {
- boolean var1 = super.model.isJITEnabled();
- this.jitButton.setSelected(var1);
- this.jitPath.setText(super.model.getJITPath());
- this.jitPathLabel.setEnabled(var1);
- this.jitPath.setEnabled(var1);
- boolean var2 = super.model.isDebugEnabled();
- this.debugButton.setSelected(var2);
- this.debugPort.setText(super.model.getDebugPort());
- this.debugPort.setEnabled(var2);
- this.debugPortLabel.setEnabled(var2);
- boolean var3 = true;
- String var4 = super.model.getJDK();
- String[] var5 = super.model.getInstalledJavaList();
-
- for(int var6 = 0; var6 < var5.length; ++var6) {
- if (var4 == null || var5[var6].equals(var4)) {
- this.jdkInstalled.setSelectedItem(var5[var6]);
- this.jdkPath.setEnabled(false);
- this.pathLabel.setEnabled(false);
- var3 = false;
- break;
- }
- }
-
- if (var3) {
- this.jdkInstalled.setSelectedItem("Other... ");
- this.jdkPath.setText(var4);
- this.jdkPath.setEnabled(true);
- this.pathLabel.setEnabled(true);
- }
-
- }
-
- public static void setHideDebugBox(boolean var0) {
- hideDebugBox = var0;
- }
-
- public static void setHideJITBox(boolean var0) {
- hideJITBox = var0;
- }
-
- private boolean setInstalledJavaList() {
- String[] var1 = super.model.getInstalledJavaList();
- if (var1 != null && var1.length != 0) {
- this.jdkInstalled.removeAllItems();
-
- for(int var2 = 0; var2 < var1.length; ++var2) {
- this.jdkInstalled.addItem(var1[var2]);
- }
-
- this.jdkInstalled.addItem("Other... ");
- return true;
- } else {
- return false;
- }
- }
- }
-