All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ow2.jonas.autostart.frame.RunningJonasOptionFrame Maven / Gradle / Ivy

The newest version!
/**
 * JOnAS: Java(TM) Open Application Server
 * Copyright (C) 2010 Bull S.A.S.
 * Contact: [email protected]
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id: RunningJonasOptionFrame.java 20819 2011-02-02 16:00:53Z benoitf $
 * --------------------------------------------------------------------------
 */
package org.ow2.jonas.autostart.frame;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Insets;

import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JSeparator;
import javax.swing.SpringLayout;
import javax.swing.border.EmptyBorder;

import org.ow2.jonas.autostart.utility.SpringUtilities;

/**
 * This class creates main panel with option fields.
 * @author skabore
 */
public class RunningJonasOptionFrame extends JPanel {

    /**
     * The content panel.
     */
    private JPanel contentPanel;

    /**
     * The icon label.
     */
    private JLabel iconLabel;

    /**
     * The label.
     */
    private JLabel label;

    /**
     * The separator.
     */
    private JSeparator separator;

    /**
     * The text label.
     */
    private JLabel textLabel;

    /**
     * The title panel.
     */
    private JPanel titlePanel;

    /**
     * The fromExistingJonas radioButton.
     */
    private JRadioButton fromExistingJonasRadioButton;

    /**
     * The fromEmbeddedJonas radioButton.
     */
    private JRadioButton fromEmbeddedJonasRadioButton;

    /**
     * The default constructor.
     * @param steps, the required steps to create a starter
     * @param stepId, the sted number
     */
    public RunningJonasOptionFrame(final int steps, final int stepId) {

        super();

        contentPanel = getContentPanel();
        contentPanel.setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));

        ImageIcon icon = getImageIcon();

        titlePanel = new javax.swing.JPanel();
        textLabel = new javax.swing.JLabel();
        iconLabel = new javax.swing.JLabel();
        separator = new javax.swing.JSeparator();

        setLayout(new java.awt.BorderLayout());

        titlePanel.setLayout(new java.awt.BorderLayout());
        titlePanel.setBackground(Color.gray);

        textLabel.setBackground(Color.gray);
        textLabel.setFont(new Font("MS Sans Serif", Font.BOLD, 14));
        textLabel.setText("Run embedded or existing JOnAS server");
        textLabel.setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
        textLabel.setOpaque(true);

        iconLabel.setBackground(Color.gray);
        if (icon != null) {
            iconLabel.setIcon(icon);
        }

        titlePanel.add(textLabel, BorderLayout.CENTER);
        titlePanel.add(new JLabel(stepId + "/" + steps + "   "), BorderLayout.EAST);
        titlePanel.add(separator, BorderLayout.SOUTH);

        add(titlePanel, BorderLayout.NORTH);
        JPanel secondaryPanel = new JPanel();
        secondaryPanel.add(contentPanel, BorderLayout.NORTH);
        add(secondaryPanel, BorderLayout.WEST);

    }

    /**
     * @return contentPanel1 the content panel.
     */
    private JPanel getContentPanel() {

        JPanel contentPanel1 = new JPanel();
        JPanel applicationPanel = new JPanel(new SpringLayout());

        fromExistingJonasRadioButton = new JRadioButton("From existing JOnAS folder");
        fromEmbeddedJonasRadioButton = new JRadioButton("From embedded JOnAS");
        ButtonGroup groupCopy = new ButtonGroup();
        groupCopy.add(fromEmbeddedJonasRadioButton);
        fromEmbeddedJonasRadioButton.setSelected(true);
        groupCopy.add(fromExistingJonasRadioButton);
        label = new JLabel(" Choose your option to run JOnAS server");

        applicationPanel.add(label);
        applicationPanel.add(new JLabel(" "));
        applicationPanel.add(fromEmbeddedJonasRadioButton);
        applicationPanel.add(fromExistingJonasRadioButton);
        SpringUtilities.makeCompactGrid(applicationPanel, 4, 1, 6, 0, 6, 0);
        contentPanel1.add(applicationPanel);

        return contentPanel1;
    }

    /**
     * @return imageIcon. the image icon.
     */
    private ImageIcon getImageIcon() {
        return null;
    }

    /**
     * @return fromExistingJonasRadioButton
     */
    public JRadioButton getExistingJonasDiskRadioButton() {
        return fromExistingJonasRadioButton;
    }

    /**
     * @return fromEmbeddedJonasRadioButton
     */
    public JRadioButton getEmbeddedJonasRadioButton() {
        return fromEmbeddedJonasRadioButton;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy