Beispiel #1
0
 public void start() {
   running = Util.isRunning();
   if (!running) {
     clearLogsDir();
     run();
   }
 }
Beispiel #2
0
 public void actionPerformed(ActionEvent event) {
   if (event.getSource().equals(launchBrowser)) {
     Configuration config = Configuration.getInstance();
     String ip = Util.getIPAddress();
     String protocol = "http" + (config.ssl ? "s" : "");
     String url = protocol + "://" + ip + ":" + config.port;
     Util.openURL(url);
   } else if (event.getSource().equals(stop)) {
     Util.shutdown();
     running = Util.isRunning();
     setStatus();
   } else if (event.getSource().equals(start)) {
     clearLogsDir();
     run();
     launchBrowser.requestFocusInWindow();
   }
 }
Beispiel #3
0
  public JavaPanel() {
    super();
    setLayout(new BorderLayout());
    config = Configuration.getInstance();
    Properties props = config.props;
    running = false;
    Util.isRunning();

    JPanel main = new JPanel();
    main.setLayout(new BorderLayout());
    main.setBackground(bgColor);

    // North Panel
    JPanel np = new JPanel();
    np.setBackground(bgColor);
    JLabel title = new JLabel(config.programName);
    title.setFont(new Font("SansSerif", Font.BOLD, 24));
    title.setForeground(Color.BLUE);
    np.add(title);
    np.setBorder(BorderFactory.createEmptyBorder(10, 0, 20, 0));
    main.add(np, BorderLayout.NORTH);

    // Center Panel
    RowPanel javaPanel = new RowPanel("Java Parameters");
    javaPanel.setBackground(bgColor);
    javaPanel.addRow(initMemory = new Row("Initial memory pool:", props.getProperty("ms", "")));
    javaPanel.addRow(maxMemory = new Row("Maximum memory pool:", props.getProperty("mx", "")));
    javaPanel.addRow(stackSize = new Row("Thread stack size:", props.getProperty("ss", "")));
    javaPanel.addRow(extDirs = new Row("Extensions directory:", props.getProperty("ext", "")));
    javaPanel.addRow(
        debugSSL = new CBRow("Enable SSL debugging:", props.getProperty("ssl", "").equals("yes")));
    javaPanel.addRow(
        javaMonitor =
            new CBRow("Enable Java monitoring:", props.getProperty("mon", "").equals("yes")));

    RowPanel serverPanel = new RowPanel("Server Parameters");
    serverPanel.setBackground(bgColor);
    serverPanel.addRow(serverPort = new Row("Server port:", Integer.toString(config.port)));
    serverPanel.addRow(
        clearLogs = new CBRow("Clear logs on start:", props.getProperty("clr", "").equals("yes")));

    JPanel cp = new JPanel();
    cp.setLayout(new RowLayout());
    cp.setBackground(bgColor);

    cp.add(serverPanel);
    cp.add(RowLayout.crlf());
    cp.add(Box.createVerticalStrut(20));
    cp.add(RowLayout.crlf());
    cp.add(javaPanel);
    cp.add(RowLayout.crlf());

    JPanel ccp = new JPanel(new FlowLayout());
    ccp.setBackground(bgColor);
    ccp.add(cp);
    main.add(ccp, BorderLayout.CENTER);

    // South Panel
    JPanel sp = new JPanel();
    sp.setBorder(BorderFactory.createEmptyBorder(10, 0, 20, 0));
    sp.setBackground(bgColor);

    start = new JButton("Start");
    sp.add(start);
    start.addActionListener(this);
    sp.add(Box.createHorizontalStrut(15));

    stop = new JButton("Stop");
    sp.add(stop);
    stop.addActionListener(this);
    sp.add(Box.createHorizontalStrut(70));

    launchBrowser = new JButton(config.browserButtonName + " Home Page");
    sp.add(launchBrowser);
    launchBrowser.addActionListener(this);

    main.add(sp, BorderLayout.SOUTH);

    this.add(main, BorderLayout.CENTER);
    this.add(new StatusPanel(status), BorderLayout.SOUTH);

    running = Util.isRunning();
    setStatus();
  }